R璇█fread鍜宺ead_delim璇诲彇鏁版嵁

- data.table鍖呬腑fread鍑芥暟姣攔eadr鍖呯殑鍑芥暟璇诲彇鏇村揩锛屼絾鏄洰鍓嶅彧鑳芥敮鎸亀indows涓婄殑gbk缂栫爜涓嶶TF-8缂栫爜

library(data.table)
timestart<-Sys.time()

x <- fread("D://data/vod/vod_month_201707.txt",sep = "\001",header = F,stringsAsFactors = F,encoding = "UTF-8",data.table = T)
timeend<-Sys.time()
runningtime<-timeend-timestart
print(runningtime) 

#Time difference of 4.058793 secs
#缁撴灉鏄剧ず娑堣��4绉�


library(readr)

timestart <- Sys.time()
y <- read_delim("D://data/vod/vod_month_201707.txt",delim = "\001")
timeend <- Sys.time()
runningtime2 <- timeend-timestart
print(runningtime2)

#缁撴灉鏄剧ず娑堣�桾ime difference of 5.136311 secs


x7 <- fread(input = paste("order_", year, month, ".txt", sep = ""),sep = "|",header = F,stringsAsFactors = F,data.table = T,encoding = "UTF-8",colClasses = c("numeric","character","character","character","character","character","character","character","character"))
colnames(x7) = c("city_id","userid","date","time","product_id","status","product_name","id","order_path")




你可能感兴趣的:(R璇█fread鍜宺ead_delim璇诲彇鏁版嵁)