作者bruce89 (啊猛)
看板R_Language
標題[問題] 載入資料(新手)
時間Wed Jul 11 20:26:30 2018
[問題類型]:
經驗諮詢(載入csv檔卻出現錯誤)
[軟體熟悉度]:
新手(沒寫過程式,R 是我的第一次)
[問題敘述]:
目前在上Udemy郭老師的R語言,在第43講的地方卡住,練習是
希望我們讀取老師提供的檔案boston-celtics-2007-08.csv
我是先將路徑指定到我的下載資料夾,並將老師提供的檔案也放置於此
downloads_windows <- "C/Users/Dell/Downloads/"
接著執行以下兩行(這兩行其實我看不太懂它的意思)
csv_file <- "C/Users/Dell/Downloads/boston-celtics-2007-08.csv"
csv_df <- read.csv(csv_file)
但在console出現以下錯誤訊息
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open file 'C/Users/Dell/Downloads/boston-celtics-2007-08.csv': No
such file or directory
想請問各位專家哪裡出錯了,謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.112.25.99
※ 文章網址: https://www.ptt.cc/bbs/R_Language/M.1531311993.A.385.html
推 clansoda: you should put a : after your disk, like C:/datapath 07/11 20:35
→ clansoda: The error message tell you that the file path is 07/11 20:36
→ clansoda: incorrect 07/11 20:36
→ bruce89: I should have checked it twice! many thanks 07/11 22:04
→ celestialgod: file.exists(csv_file)是TRUE還是FALSE? 07/11 22:49
→ celestialgod: 如果是TRUE,問題就可能是權限了 07/11 22:49
→ celestialgod: 如果是FALSE,就真的是你檔案放錯地方 07/11 22:49
→ celestialgod: 或是打錯名字 07/11 22:49
→ celestialgod: 可以試試看用list.files(dirname(csv_file))確定一 07/11 22:50
→ celestialgod: 下 07/11 22:50
→ asdwezx25: 應該是檔名對了,但絕對路徑不完整... 07/12 08:30
→ bruce89: 謝謝以上版友 07/15 13:29