簡體   English   中英

新 session 打開后,在 R 目錄中找不到文件

[英]Can't find file in R directory after new session is open

我一直在使用 RStudio 進行 R 項目一段時間,當我今天回去編輯幾行時,我無法連接到 csv 文件,我一直在使用我的目錄。

當我嘗試重新運行代碼時,它告訴我該文件不存在/不在目錄中(但它在那里,我可以在我的 finder 文件夾中看到它)。

就在我編寫前兩行代碼時,這是我收到的錯誤消息:

library(ggplot2)
read.csv("Airbnb_Milan.csv")

Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'Airbnb_Milan.csv': No such file or directory

我嘗試更改文件的位置,甚至打開另一個腳本並再次下載 csv 文件,但到目前為止沒有任何效果。 任何線索在這里做什么?

嘗試getwd()以真正查看當前工作目錄的內容。 您可以通過setwd()設置文件的正確路徑。 如果您確保您在 finder 中查看的路徑與您設置為工作目錄的路徑相同,那么您會沒事的。

最好的

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM