简体   繁体   English

R不允许我打开保存的文件,说“没有这样的文件或目录”

[英]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. 我几周前才刚开始使用R,我是使用该程序的研究小组的一名新学生。

My supervisor gave me a file with the ending .idx to open in R and work on. 我的主管给了我一个以.idx结尾的文件,可以在R中打开并继续使用。 I was eventually able to open it yesterday, but it took me 45 minutes! 我终于可以在昨天打开它,但是花了我45分钟! I thought I'd figured out how to do it yesterday, but again today R is telling me the file doesn't exist. 我以为昨天想出了办法,但今天R又告诉我该文件不存在。

Yesterday I used list.files and file.exists and the file magically seemed to exist. 昨天我使用了list.files和file.exists,并且该文件似乎魔术般地存在。

Please can anybody tell me how to reopen saved files from R back on to the console? 请有人告诉我如何从R重新打开保存的文件并回到控制台吗?

R won't let me open saved file, says “no such file or directory” R不允许我打开保存的文件,说“没有这样的文件或目录”

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. 尝试在R命令提示符下键入getwd() ,看看它返回的路径。 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). 在这种情况下,您可以将文件移到R的当前工作目录中,也可以在R命令提示符下键入setwd("/path/to/the/file")来设置路径(显然, /path/to/the/file应该替换为包含文件的目录的路径)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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