重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

R语言读取大数据data.table包fread函数

> setwd("D:\\R_Tardy")
> library(data.table)
//  data.table 1.9.6  
// For help type ?data.table or 
// https://github.com/Rdatatable/data.table/wikiThe fastest way to learn (by data.table authors): 
//  https://www.datacamp.com/courses/data-analysis-the-data-table-way
> TestDT <- fread("test.txt", sep = "\t",header = FALSE, na.strings = "NA") 

// 查看文件前几行
> head(TestDT)
//  重 命 名 列的名字
> colnames(TestDT) <- c("ID","num","desc")
> head(TestDT)
> df <- TestDT[TestDT$desc %in% c("Heat group"), 1:ncol(TestDT), with=FALSE]
> df1 <- data.frame(df)
> nrow(df1)

分享名称:R语言读取大数据data.table包fread函数
转载源于:http://cqcxhl.com/article/iiesih.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP