码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2016-06-20 16:02:51      阅读:1260      评论:0      收藏:0      [点我收藏+]

标签:r   data.table   fread   data.frame   

> 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函数

标签:r   data.table   fread   data.frame   

原文地址:http://matrix6ro.blog.51cto.com/1746429/1790941

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!