R语言读取大数据
发表于:2024-09-30 作者:千家信息网编辑
千家信息网最后更新 2024年09月30日,普通情况下使用scan读取数据x <- scan("D:\\test.txt")按列读入,指定数据类型x <- scan("test2dat.txt", what=list("",0,0)) #读取
千家信息网最后更新 2024年09月30日R语言读取大数据
普通情况下使用scan读取数据
x <- scan("D:\\test.txt")
按列读入,指定数据类型
x <- scan("test2dat.txt", what=list("",0,0)) #读取三列数据,第一列是字符,第二和第三列是数值#以下写法也可以x2 <- scan("test2dat.txt", list(name="", num1=0,num2=0)) # 每个list都有个名字,分别为name,num1,num2
可以指定读取的行数,以下为读取以逗号分割的csv文件的读取方法
mydata <- read.table("test_nrow.txt.txt",sep=",", header=TRUE,nrow=5) #读取除了表头之外的5行数据
参考: http://www.biostat.jhsph.edu/~rpeng/docs/R-large-tables.html
tab5rows <- read.table("datatable.txt", header = TRUE, nrows = 5)classes <- sapply(tab5rows, class)tabAll <- read.table("datatable.txt", header = TRUE, colClasses = classes)
也可以用data.table 读取大数据
install.packages("data.table")library(data.table)mydata <- fread("test.table.txt") #读取文件时会显示 Read **.*% of ***** rows, 读取完毕会有提示#查看文件的前6行head(mydata)
参考:http://www.r-bloggers.com/reading-large-data-tables-in-r/
也可以使用ff包
setwd("D:/data test")library(ff)ffdf1 <- read.table.ffdf(file = "test.ido", header = TRUE, sep = "|")
参考: http://stackoverflow.com/questions/11782084/reading-in-large-text-files-in-r
http://www.bytemining.com/wp-content/uploads/2010/08/r_hpc_II.pdf
使用Python打开大数据的话,采用mmap
参考: http://stackoverflow.com/questions/11159077/python-load-2gb-of-text-file-to-memory
http://davetang.org/muse/2013/09/03/handling-big-data-in-r/
数据
参考
文件
普通
写法
名字
字符
情况
数值
方法
类型
表头
逗号
别为
提示
语言
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
宜兴多功能软件开发设计规范
boss服务器繁忙什么意思
软件开发历史顺序是正确的
自主可控网络安全行业
投资5g网络安全三线蓝筹股
天融信网络安全市场追踪
身份证号码户籍归属地数据库
数据库di
昆山品牌网络技术服务电话
数据库能放音乐资源吗
网络安全橱窗展示设计效果图
梦幻西游四海升本服务器
安卓手机老是无法连接服务器
软件开发2022
金铲铲之战黑夜使者服务器
河北省网络安全知识培训班
华为店铺网络安全问题
计算机网络安全绘画教程
我的世界手机基岩版服务器有延迟
高科技网络技术代理价钱
数据库字段防篡改
三丰云服务器怎么申请延期
网络安全抄写图
广州erp软件开发外包
宿舍路由器远端服务器无响应
东东网络技术老师
如何架设服务器管理软件
sa附加数据库提示挂起
天台定制软件开发解决方案
中国现阶段互联网科技发展