在CRAN网站上有一篇专门关于R语言数据的帮助文档,叫R-data.pdf的,具体的网址百度下吧。
借用文档的第一段:
Readingdata into a statistical system for analysis and exporting the results to someother systemfor report writing can be frustrating tasks that can take far moretime than the statistical analysisitself, even though most readers will findthe latter far more appealing.
具体的翻译就不玩啦,本人英语不行,只能是理解大概的意思。我就结合这篇文档和《R语言实战》,简单的总结了一下几个常用的数据导入的方法。(不完善的地方,后续继续修改)
一、利用手动输入的方式
mydata<-data.frame(age=numeric(0)) edit(mydata) |
用edit()函数,会打开一个待输入的框,在数据量小的时候不失为一个快速方便的方法,可是如果数据量太大就不行了。
二、从csv、txt等带有分隔符的文件读取