read_html r语言,R语言read.xlsx()解读

read.xlsx(file, sheetIndex, sheetName=NULL, rowIndex=NULL,startRow=NULL, endRow=NULL, colIndex=NULL,as.data.frame=TRUE, header=TRUE, colClasses=NA,keepFormulas=FALSE, encoding="unknown", ...)

file文件读取的路径

sheetIndex在工作簿中表示的表索引的数字

sheetName工作簿中表示的表索引的名称

rowIndex/colIndex为空则提取所有行/列数据,数字向量指定想要提取的行/列

as.data.frame a logical value indicating if the result should be coerced into a data.frame. If FALSE, the result is a list with one element for each column.

headerT or F,指定读取表格的第一行是否包含变量名称

colClassesFor read.xlsx a character vector that represent the class of each column. Recycled as necessary, or if the character vector is named, unspecified values are taken to be NA. For read.xlsx2 see readColumns.

keepFormulas a logical value indicating if Excel formulas should be shown as text in R and not evaluated before bringing them in.

encoding设定字符串编码格式

startRow/endRow指定要开始/结束读取数据的行数

read.xls()需要加载xls包,要求读入文件为Excel2007及以上版本;但是网上说数据量大时用xlsx包有时会出错,而且速度极慢

网上搜到另外一种读取execl表中部分数据的方法,觉得R这种读法简直是酷毙了

在execl表格中圈住想要读取的数据部分,选择“复制”,在R中执行命令read.table("clipboard")可以直接读出选中的数据

更为习惯的读取execl的方法是保存为csv格式即逗号分隔文件,用read.csv()读取。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值