您的位置:首页 > 产品设计 > UI/UE

在RGui中实现数据源的导入(数据框,.txt,excel,MySQL)

2017-06-04 08:41 323 查看
数据框中数据导入

> 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格式)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: