loads_MSqRob: Loading only given variables of a data.frame from binary file

loads_MSqRobR Documentation

Loading only given variables of a data.frame from binary file

Description

loads_MSqRob is almost a pure copy of the loads function from the saves package by Dar\'oczi (2013) with some minor code tweaks to make it work for MSqRob. It loads data from a special binary file format (RDatas) made up by the MSqRob_saves function. This special, uncompressed tar archive inlcudes several separate RData files (saved by MSqRob_saves function) as being columns/variables of a data frame.

Usage

loads_MSqRob(file = NULL, variables = NULL, ultra.fast = FALSE,
  printProgress = FALSE, shiny = FALSE, message = NULL)

Arguments

file

character string: the (RDatas) filename from which to load the variables. If using ultra.fast = TRUE option, specify the directory holding the uncompressed R objects (saved via MSqRob_saves(..., ultra.fast = TRUE)).

variables

Optional: a character vector containing the variable names to load. If not specified, all variables will be loaded.

ultra.fast

boolean: if TRUE, ultra fast (...) processing is done without any check to parameters or file existence/permissions. Be sure if using this setting as no debugging is done! Only recommended for servers dealing with lot of R objects' saves and loads in a monitored environment. Also, for performance gain, it is advised not to convert the list to data frame (to.data.frame = FALSE).

to.data.frame

boolean: the default behavior of loads is to concatenate the variables to a list. This could be overriden with TRUE argument specified at to.data.frame parameter, which will return a dataframe instead of list. Only do this if all your variables have the same number of cases!

Details

The purpose of this function is to be able only a few variables of a data.frame really fast. It is done by reading and writing datas in binary format without any transformations, and combining the speed of only reading the needed part of an archive.

Some minor experiments shows a huge performance gain against using SQLite/MySQL backends or loading whole binary data, but be conscious always choosing the aprropriate method to write and read data.

The author of the saves package (Dar\'oczi) emphasizes: this package could be useful only in few cases!

Value

Loaded data.frame.

References

Dar\'oczi, G. (2013). saves: Fast load variables. R package version 0.5, URL http://cran.r-project.org/package=saves

See Also

Other saves_MSqRob to save R objects to RDatas binary format: inspect_loads_MSqRob

Other inspect_loads_MSqRob to inspect the content of an RDatas binary object.: saves_MSqRob

Examples

## Not run:
# Loading the 'v1' and 'v5' variables of the demo dataset.
data(evs.2000.hun)
saves(evs.2000.hun)
evs.filtered.list <- loads("evs.2000.hun.RDatas", c('v1', 'v5'))
evs.filtered.df <- loads("evs.2000.hun.RDatas", c('v1', 'v5'), to.data.frame=TRUE)

## End(Not run)

statOmics/MSqRob documentation built on Dec. 8, 2022, 6 a.m.