> 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)
转载于:https://blog.51cto.com/matrix6ro/1790941
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)