R - csv读写

注意:csv数据“,”后面的空格也会被算入新的字段,","前后不要有空格。

读取csv文件加载为dataframe:

df <- read.csv('play.csv', header = TRUE, sep = ",")
查看内容:
> df
    Outlook Temperature Humidity Windy Play
1     sunny         hot     high FALSE   no
2     sunny         hot     high  TRUE   no
3  overcast         hot     high FALSE  yes
4     rainy        mild     high FALSE  yes
5     rainy        cool   normal FALSE  yes
6     rainy        cool   normal  TRUE   no
7  overcast        cool   normal  TRUE  yes
8     sunny        mild     high FALSE   no
9     sunny        cool   normal FALSE  yes
10    rainy        mild   normal FALSE  yes
11    sunny        mild   normal  TRUE  yes
12 overcast        mild     high  TRUE  yes
13 overcast         hot   normal FALSE  yes
14    rainy        mild     high  TRUE   no
将dataframe写入csv文件中:
write.csv(df, file = "result.csv")


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值