读入外部文件

Delimited files(符号分割文件)

*based on the read.table()function

read.table(file, header, sep = , quote = , dec = , row.names, col.names,as.is = , na.strings , colClasses , nrows =, skip = ,check.names = , fill = , strip.white = , blank.lines.skip = ,comment.char = , allowEscapes = , flush = , stringsAsFactors = ,encoding = )

sep 假定每个字段之间都有一个分隔符:例如有一个文件top.5.salsries.csv,内容如下:

name.last,name.first,team,position,salary
“Manning”,”Peyton”,”Colts”,”QB”,18700000
“Brady”,”Tom”,”Patriots”,”QB”,14626720
“Pepper”,”Julius”,”Panthers”,”DE”,14137500
“Palmer”,”Carson”,”Bengals”,”QB”,13980000
“Manning”,”Eli”,”Giants”,”QB”,12916666
上例中,文本字段都是有引号的,每个字段由逗号分割。假定该文件在当前目录下,读取该文件:

  top.5.salaries <- read.table("top.5.salaries.csv", header=TRUE, sep=",", quote="\"")

读取数据

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值