nrOfRows <- 1e7
x <- data.frame( Integers = 1:nrOfRows, # integer Logicals = sample(c(TRUE, FALSE, NA), nrOfRows, replace = TRUE), # logical Text = factor(sample(state.name , nrOfRows, replace = TRUE)), # text Numericals = runif(nrOfRows, 0.0, 100), # numericals stringsAsFactors = FALSE)
head(x)
tail(x)
tw_saveRDS <- system.time({
saveRDS(x, "c:/R/Github/saveRDS.rds")
})
tw_saveRDS
tw_saveRDS_nc <- system.time({
saveRDS(x, "c:/R/Github/saveRDS_nc.rds", compress = F)
})
tw_saveRDS_nc
tr_saveRDS <- system.time({
readRDS("c:/R/Github/saveRDS.rds")
})
tr_saveRDS_nc <- system.time({
readRDS("c:/R/Github/saveRDS_nc.rds")
})
tw_saveRDS
tw_saveRDS_nc
tr_saveRDS
tr_saveRDS_nc
install.packages("feather")
library(feather)
tw_feather <- system.time({
write_feather(x, "c:/R/Github/feather.feather")
})
tw_feather
tr_feather <- system.time({
read_feather("c:/R/Github/feather.feather")
})
tr_feather
a <- feather("c:/R/Github/feather.feather")
b <- a[5000:6000, 1:3]
b
install.packages("fst")
library(fst)
tw_fst <- system.time ({
write.fst(x, "c:/R/Github/datafst.fst")
})
tw_fst
tr_fst <- system.time ({
a <- read.fst("c:/R/Github/datafst.fst")
})
tr_fst
head(a)
tail(b)
tr_fst_slice <- system.time ({
b <- read.fst("c:/R/Github/datafst.fst", c("Logicals", "Text"), 2000, 4990)
})
tr_fst_slice
b
head(b)
tail(b)
library(data.table)
tw_fwrite <- system.time ({
fwrite(x, "c:/R/Github/fwrite.csv")
})
tw_fwrite
tr_fread <- system.time ({
fread("c:/R/Github/fwrite.csv")
})
tr_fread