Tôi mới sử dụng R và tôi đang cố gắng tìm cách nhập tệp csv để tôi có thể theo dõi video này: R ggplot2 Graphics Histograms.Người mới bắt đầu tìm cách nhập tệp csv đơn giản vào R
Tôi đã cài đặt tất cả các gói thích hợp bao gồm ggplot
và các gói có liên quan. Hướng dẫn đầu tiên trong video cho biết loại afl.df=read.csv("afl_2003_2007.csv")
Vì vậy, tôi đã tải xuống tệp afl_2003_2007.csv và thử tất cả những điều dưới đây về cơ bản đặt tệp trong các thư mục khác nhau (ổ đĩa chia sẻ rồi ổ c ...). Tôi cũng đã thử sử dụng setwd
và không may mắn.
làm rõ: Tôi đang sử dụng R trong cửa sổ
Xin vui lòng trợ giúp. Dan
GÌ tôi đã cố gắng và các lỗi tôi GOT:
> afl.df=read.csv("afl_2003_2007.csv")
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open file 'afl_2003_2007.csv': No such file or directory
> afl.df=read.csv("\\the-lab.llnl.gov\llnlusers1\lopez235\Data\Documents\Dashboards,HRBI, Visulizations and Analytics\Math and Statistics and Predictive Modeling1\R Programming\afl_2003_2007.csv")
Error: '\l' is an unrecognized escape in character string starting "\\the-lab.llnl.gov\l"
> afl.df=read.csv("C:\Users\lopez235\Local-NOTBackedUp\R Files Local\afl_2003_2007.csv")
Error: '\U' used without hex digits in character string starting "C:\U"
> setwd("\\the-lab.llnl.gov\llnlusers1\lopez235\Data\Documents\Dashboards,HRBI, Visulizations and Analytics\Math and Statistics and Predictive Modeling1\R Programming\afl_2003_2007.csv")
Error: '\l' is an unrecognized escape in character string starting "\\the-lab.llnl.gov\l"
> setwd("\\the-lab.llnl.gov\llnlusers1\lopez235\Data\Documents\Dashboards,HRBI, Visulizations and Analytics\Math and Statistics and Predictive Modeling1\R Programming")
Error: '\l' is an unrecognized escape in character string starting "\\the-lab.llnl.gov\l"
> setwd("C:\Users\lopez235\Local-NOTBackedUp\R Files Local")
Error: '\U' used without hex digits in character string starting "C:\U"
Sử dụng dấu gạch chéo hoặc gấp đôi thay vì \\, \\ thay vì \. \ trong chuỗi là một ký tự thoát. – Hansi
Sử dụng/thay vì \ cho cửa sổ. – Justin
Sự trả thù của Bill Gates, 20 năm sau. –