README.md

romRDS an Read or Make RDS

R-CMD-check codecov GitHub code size in bytes

The romRDS package provides a wrapper that handles assignment of the code's resulting value to an object. The wrapper automatically saves the value in .rds and for later invocations can use this file to skip evaluation. Basically the wrapper either Reads from the disk Or Makes RDS files for later reuse (hence romRDS name). The main motivation is to avoid unnecessary reevaluation of some computationally expensive code chunks (e.g., when your R session crashed and you lost all the objects) and free up from frequent snapshots of the entire environment to the .Rdata.

Usage

## consider some evaluation with subsequent assignment to object
my_object_name <- Sys.sleep(5)

## the above will take 5 sec every time

## the romRDS package provides the romRDS function (its infix equivalent is %<--%)
romRDS("my_object_name", Sys.sleep(5))

## the equivalent of the above in infix form
my_object_name %<--% Sys.sleep(5)

## multiple commands can be wrapped in {} as usual
my_object_name %<--% {
    Sys.sleep(5)
    data.frame(1:10, runif(10))
}

## or you can use R pipes introduced since R v4.0
## note that maggritr pipes probably won't work
my_object_name %<--%
    Sys.sleep(5) |>
    paste0("Sys.sleep returns NULL so prepending it to this string does not change it.")

Installation

devtools::install_github("nil")

By default the package installation does not rely on any dependencies. However, if you need to some additional features (e.g., robust parameters checking and working with STATA's dta files) you need to install it with extra suggested dependencies.

devtools::install_github("nil", dependencies = TRUE)

Dependencies

| name | version | comment | |---------------------------------|---------|-------------------------------------------| | R | 4.2.0 | minimum R version to enable native piping |

Hard dependencies (Depends field in DESCRIPTION file)

Suggested packages

| name | version | comment | |---------------------------------------------------------------------------------|---------|-----------------------------------------------------------| | tinytest | | for testing | | humanFormat | | for formatting messages | | checkmate | | function arguments checker, ensures stability | | haven | | reads STATA .dta files | | data.table | | fast data.frames, used as main input and output data type |

Suggested packages (Suggests field in the DESCRIPTION file)

| name | version | comment | |----------------------------------|---------|----------------------| | unrar | 6.12 | RAR archives utility |

Suggested system packages

Development dependencies and tools

These packages are used for developing and building romRDS

| name | version | comment | |--------------------------------------------------------------------|---------|-------------------------------| | devtools | | builds the package | | roxygen2 | | makes docs | | languageserver | | provides some IDE consistency | | usethis | | repo utils |

Useful packages for development



stasvlasov/romRDS documentation built on July 31, 2023, 4:36 p.m.