数据框中数据导入
> mydata<-data.frame(age=numeric(0),
+ gender=character(0),
+ weight=numeric(0))
> mydata<-edit(mydata)
Warning message:
In edit.data.frame(mydata) : 在'gender'里加上了因子水准
> mydata
age gender weight high
1 1 m 120 180
2 2 f 89 170
3 3 m 98 160
> fix(mydata)
> mydata
age gender weight high
1 1 f 120 180
2 2 f 89 170
3 3 f 98 160
读取.txt中的数据(ANSI格式)
> data<-read.table("C:/test.txt",header=TRUE,sep=",")
> head(data)
id sgbh
1 1 123
读取excel表格中的数据(转化为csv格式)
本文介绍了如何使用R语言进行数据导入的基本操作,包括创建数据框并编辑数据、从txt文件和Excel表格中读取数据的方法。
&spm=1001.2101.3001.5002&articleId=95126780&d=1&t=3&u=ca52cb4421db4cc58bb33e7254986242)
5万+

被折叠的 条评论
为什么被折叠?



