简体   繁体   中英

R Error: Cannot read in xls spreadsheet in R, gives “Error in file.exists(tfn) : invalid 'file' argument”

I'm trying to do an exercise from the Doing Data Science book, and at this code I keep erroring out.

mt <- read.xls("rollingsales_manhattan.xls", perl="C:\\Perl64\\bin\\perl.exe", pattern="BOROUGH",stringsAsFactors=FALSE)

With this error...

Error in xls2sep(xls, sheet, verbose = verbose, ..., method = method,  : 
  Intermediate file 'C:\Users\carson\AppData\Local\Temp\RtmpMjMWfI\file267c48c84956.csv' missing!
Error in file.exists(tfn) : invalid 'file' argument

I've added that perl value to my method call, to specify where the Perl interpreter is on my machine. I've made sure the working directory is correct and the file name is correct...doing the following command to verify...

> list.files()
 [1] "Capture.PNG"                        "dds_ch2_rollingsales"              
 [3] "gross_sqft_vs_price.png"            "gross_sqft_vs_price_with_trend.png"
 [5] "load_cleandata.r"                   "model1 vs index.png"               
 [7] "model2 vs index.png"                "model2a vs index.png"              
 [9] "model3 vs index.png"                "model4 vs index.png"               
[11] "rollingsales_manhattan.xls"  

Any help?

从头开始重新启动R Studio可以解决此问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM