Trying to open data from government website (hud.gov) about Rental Assistance Demonstration:
http://radresource.net/pha_data.cfm.
The document appears to be an xls file but opening it in Google Docs failed so I tried R. Both readxl::read_xls and readr::read_tsv (as suggested on GitHub) just gave me this BS (Google Doc file or you can just download from radresource above). Any help would be muy apreciado!
I think there is something wrong with the files. I am also unable to open them with anything (excel, googledocs, R, etc.)
Related
I met a problem to open mht files in R. There is an approach in which first I need to open it in Excel then save as .xlsx and after that read it in R.
But this way doesn't correspond to my requirements as soon as I need the program which must work automatically (no manual work needed).
But unfortunately I didn't found in the Internet how to do this.
Can someone advise me the way in which I can open file with mht format with some data in R?
I'm very new to coding in R and do not know what I am doing. I am trying to map some environmental variables but I cannot open this one file. This is the link to the files I want to open:
https://www.nodc.noaa.gov/archive/arc0107/0162565/2.2/data/0-data/mapped/
This link opens to a page with 2 folders in which I would like the GLODAPv2_Mapped_Climatology.tar.gz I do not know if I need to add this into the link when trying to open in R. I do not know what link is needed but this is the download link:
https://www.nodc.noaa.gov/archive/arc0107/0162565/2.2/data/0-data/mapped/GLODAPv2_Mapped_Climatology.tar.gz
I have tried downloading this folder and when I open in R it shows no data for the specific environmental variables in the mapped climatology variables, I think it is because the file is too large, so I saw coding where you use the link to open the folder in R.
So if someone could please help me in telling me how to open this folder into r and how to extract the files I specifically want for my maps, In this file I would like to access these 4 variables:
GLODAPv2.OmegaAinsitu
GLODAPv2.OmegaCinsitu
GLODAPv2.talk
GLODAPv2.tco2
I have tried everything to try and get the files into R but all the coding I try doesn't work. If someone knows how to get these files into R and produce them into maps I would be very grateful!
I hope someone can help me solve the problem I am currently facing with excel. I have been trying to export a csv file I wrote in Excel Ver 16 into R studio but it keeps giving the "incomplete final line found by readTableHeader on 'Book1.csv'" error. I have included the screen shot of the error and the files I had used for this. This doesnt seem to happen for the other data set I downloaded directly from Kaggle called "adult-test.csv" though.
I have tried everything from reinstalling R, R studio, Excel, I even resorted to using Google Sheets and it still doesn't work. If anyone knows what I am doing wrong please do help!
Image of my R studio code
Picture of the csv file I am failing to read
Hard to guess here.
Sometimes Excel saves csv files incorrectly - even though cells below your table are empty Excel saves them in the csv because maybe in the past, there was something written in there.
So, here is a suggestion
Maybe try to read the Excel file directly, not save it first as a csv. You can do that for example with read.xlsx() from the openxlsx package.
If that does not help, please open the csv file with a text editor (not with Excel again). You will then be able to see the actual problem and if necessary, post the text here (instead of the Excel screenshot)
At first, I tried to read and write xlsx files in R (while comparing the output between the xlsx and openxlsx packages).
I work on mac os.
It worked well to read xlsx files using the read.xlsx() from both packages.
However, when it comes to writing a new file, only the xlsx::write.xlsx() worked.
To be more exact, the openxlsx::write.xlsx() command gave no error, and an xlsx file was successfully saved, but when I tried to open the file using Numbers (by double clicking on the file in the folder), an error message popped up telling me the file cannot be opened.
I tried different data frames, but the results remained the same. To show an example, please refer to the following line which I took directly from R help page. It should work but does not work for me.
write.xlsx(iris, file = "writeXLSX1.xlsx", colNames = TRUE, borders = "columns")
Anyone tell me what the problem is? I tried to google for old threads but it seems no one is discussing this problem. I know in many similar threads people suggested changing packages, okay...before that, can you tell me what the limitations of openxlsx are?
I'm trying to load an Excel workbook with a large number of tabs into R, do some analysis, and then export the results back into Excel. I'm using the openxlsx package because of some of the features of that package that are not easily accessible using other packages (such as the ability to create "comments" in the output file, color code the tabs, and work with 64-bit R).
When I try to read in the workbooks, I sometimes get the following error message (or something similar):
Error in unzip(xlsxFile, exdir = xmlDir) :
cannot open file 'C:/Users/MENDEL~1/AppData/Local/Temp/RtmpIb3WOf/_excelXMLRead/xl/worksheets/sheet5.xml': Permission denied
This error message doesn't always show up - but sometimes it will appear and the program crashes.
Does anyone have any ideas how to fix this problem? I don't know why the program sometimes thinks it doesn't have permission to access the sheets.
Thank you in advance!
I can think of two possible scenarios for this error:
Scenario 1:
C:/Users/MENDEL~1/AppData/Local/ (This looks like you are trying to read a temporary file)
Solution:
If that is the case try moving the file to a different location like desktop and make sure that you update your working directory accordingly.
Scenario 2
C:/Users/MENDEL~1/AppData/Local/Temp/RtmpIb3WOf/_excelXMLRead/xl/worksheets/sheet5.xml' (Looks like there is some issue with Sheet5 which is of type .xml and the openxlsx does not allow you to read .xml)
Solution:
Check if there is some issue with the format or contents of sheet5 in the file that you are trying to read.
For additional information check CRAN Documentation