简体   繁体   中英

R won't let me open saved file, says “no such file or directory”

I just started using R a couple of weeks ago, I'm a new student in a research group that uses the program.

My supervisor gave me a file with the ending .idx to open in R and work on. I was eventually able to open it yesterday, but it took me 45 minutes! I thought I'd figured out how to do it yesterday, but again today R is telling me the file doesn't exist.

Yesterday I used list.files and file.exists and the file magically seemed to exist.

Please can anybody tell me how to reopen saved files from R back on to the console?

R won't let me open saved file, says “no such file or directory”

It sounds like you just don't have the working directory set to the directory that contains the file in question. Try typing getwd() at the R command prompt and see what path it returns. Chances are, it's not the path were your file is. In that case, you can either move the file into R's current working directory, or you can type setwd("/path/to/the/file") at an R command prompt to set the path (obviously, /path/to/the/file should be replaced with the path to the directory containing your file).

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