作者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://webptt.com/cn.aspx?n=bbs/R_Language/M.1531311993.A.385.html
1F:推 clansoda: you should put a : after your disk, like C:/datapath 07/11 20:35
2F:→ clansoda: The error message tell you that the file path is 07/11 20:36
3F:→ clansoda: incorrect 07/11 20:36
4F:→ bruce89: I should have checked it twice! many thanks 07/11 22:04
5F:→ celestialgod: file.exists(csv_file)是TRUE还是FALSE? 07/11 22:49
6F:→ celestialgod: 如果是TRUE,问题就可能是权限了 07/11 22:49
7F:→ celestialgod: 如果是FALSE,就真的是你档案放错地方 07/11 22:49
8F:→ celestialgod: 或是打错名字 07/11 22:49
9F:→ celestialgod: 可以试试看用list.files(dirname(csv_file))确定一 07/11 22:50
10F:→ celestialgod: 下 07/11 22:50
11F:→ asdwezx25: 应该是档名对了,但绝对路径不完整... 07/12 08:30
12F:→ bruce89: 谢谢以上版友 07/15 13:29