如何在 R 中导入 CSV 文件? [英] How do I import a CSV file in R?
本文介绍了如何在 R 中导入 CSV 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的工作站中有一个 .csv
文件.如何在 R 中打开该文件并进行统计计算?
解决方案
您将使用 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
.
这篇关于如何在 R 中导入 CSV 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文