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

时间:2017-06-04 09:47:11   收藏:0   阅读:1209

数据框中数据导入

> 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格式)

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!