Size of dataframe saved as CSV
csv_size.RdEstimate the size of a dataframe saved as a CSV file.
Arguments
- x
A data.frame that would be written to disk as a CSV.
- frac
A numeric value between 0 and 1. The fractional size of
xused for estimation of complete CSV size on disk.- format
TRUE or FALSE. If TRUE, automatically choose nice unit (megabytes, gigabytes, etc) for file size. If FALSE, file size in bytes.
Examples
#----------------------------------------------------------------------------
# csv_size() examples
#----------------------------------------------------------------------------
library(bkmisc)
# a data.frame with 50 columns and 100,000 rows of all numeric values
tmp <- data.frame(replicate(50, rnorm(10^5)))
csv_size(x = tmp, frac = 0.1, format = TRUE)
#> [1] "87.3 Mb"
csv_size(x = tmp, frac = 0.1, format = FALSE)
#> [1] 91501300