R中高效读取文件readxl, read.fwf
来源:互联网 发布:柳叶刀烟瘾 知乎 编辑:程序博客网 时间:2024/05/16 18:58
read.fwf
ff <- tempfile()cat(file = ff, "123456", "987654", sep = "\n")read.fwf(ff, widths = c(1,2,3)) #> 1 23 456 \ 9 87 654
V1 V2 V31 1 23 4562 9 87 654
read.fwf(ff, widths = c(1,-2,3)) #> 1 456 \ 9 654unlink(ff)
V1 V21 1 4562 9 654
cat(file = ff, "123", "987654", sep = "\n")read.fwf(ff, widths = c(1,0, 2,3)) #> 1 NA 23 NA \ 9 NA 87 654unlink(ff)cat(file = ff, "123456", "987654", sep = "\n")read.fwf(ff, widths = list(c(1,0, 2,3), c(2,2,2))) #> 1 NA 23 456 98 76 54unlink(ff)
readxl包读取xls,xlsx
读取每个sheets中的数据
excel_sheets(system.file("extdata/datasets.xlsx", package = "readxl"))excel_sheets(system.file("extdata/datasets.xls", package = "readxl"))# To load all sheets in a workbook, use lapplypath <- system.file("extdata/datasets.xls", package = "readxl")lapply(excel_sheets(path), read_excel, path = path)
read_excel
read_excel(path, sheet = 1, col_names = TRUE, col_types = NULL(numeric,date,or text), na = "",skip = 0)
datasets <- system.file("extdata/datasets.xlsx", package = "readxl")read_excel(datasets)# Specific sheet either by position or by nameread_excel(datasets, 2)read_excel(datasets, "mtcars")
0 0
- R中高效读取文件readxl, read.fwf
- 规模数据导入高效方式︱将数据快速读入R—readr和readxl包
- fwf
- R读取含中文excel文件,read.xlsx乱码问题
- 【R语言】R读取含中文excel文件,read.xlsx乱码问题
- R语言读CSV、txt文件方式以及read.table read.csv 和readr(大数据读取包)
- R语言读CSV、txt文件方式以及read.table read.csv 和readr(大数据读取包)
- R语言读CSV、txt文件方式以及read.table read.csv 和readr(大数据读取包)
- R read.table读取数据中的困惑
- php 高效读取文件
- python 高效读取文件
- 高效文件读取 - python
- python中读取文件函数read()、readline()、readlines()的区别
- R从文件中读取数据,输出文件
- Get data out of excel and into R with readxl
- 将数据快速读入R—readr和readxl包
- R语言读取文件
- R读取excel文件
- TCP网络编程中connect()、listen()和accept()三者之间的关系
- 将日志源转换为字符串和类
- 随记_2015_05_10
- JAVA类集框架 List、Set、Iterator、Map的简单理解
- 如何用Eclipse将普通的JavaWeb项目转为Maven项目
- R中高效读取文件readxl, read.fwf
- String to Integer (atoi)
- 我的iOS开发 4-Objective-C C相关杂项
- 【Java】Java包装类,Java的自动打包(装箱)与解包(拆箱)
- Web分层设计研究(四)
- 【C语言】 厄密多项式(递归函数)
- hadoop在数据挖掘方面架构设计
- Web分层设计研究(完)
- applet、object遮挡div问题处理