且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 R 中导入 CSV 文件?

更新时间:2022-10-16 09:43:22

您将使用 read.csv 函数;例如:

dat = read.csv("spam.csv", header = TRUE)

您还可以参考本教程了解更多详情.>

注意:确保要读取的 .csv 文件位于您的工作目录中(使用 getwd())或指定正确的路径归档.如果需要,您可以使用 setwd 设置当前目录.

I have a .csv file in my workstation. How can I open that file in R and do statistical calculation?

You would use the read.csv function; for example:

dat = read.csv("spam.csv", header = TRUE)

You can also reference this tutorial for more details.

Note: make sure the .csv file to read is in your working directory (using getwd()) or specify the right path to file. If you want, you can set the current directory using setwd.