我正在尝试导入一个.csv
文件,以便我可以跟随这个视频:R ggplot2 Graphics Histograms。
我安装了所有正确的软件包,包括ggplot
和相关的软件包。视频中的第一条指令说要输入afl.df=read.csv("afl_2003_2007.csv")
因此,我下载afl_2003_2007.csv
了文件,并尝试了以下所有方法,基本上是将文件放在不同的目录中(共享驱动器,然后是 C 驱动器等)。我也尝试过使用setwd
,但没有运气。
我在 Windows 中使用 R。
这是我尝试过的,以及我得到的错误:
> 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"