Save/Load froth Sessions
save-load-froth.Rd
Methods to preserve user-defined entries and variables.
Arguments
- file
Path to a file used for saving/loading
- ...
Additional arguments passed to
saveRDS
Details
saveFrothSession
saves current user-defined methods and variables within the Froth dictionary to the file specified. Built-in methods are loaded when the package is attached, so these aren't saved. Note that methods defined using froth.RDefine
are currently not able to be saved.
loadFrothSession
will restart the froth environment, which will erase any current user-defined methods and variables. It then loads the contents of the the file specified into the current Froth session.
Value
None. loadFrothSession
will update internal froth stacks, and saveFrothSession
will save to a file.
Author
Aidan Lakshman ahl27@pitt.edu
Examples
tf <- tempfile()
froth.RDefine('rnorm', rnorm, 3L)
saveFrothSession(tf)
froth.reset()
#> NULL
froth.parse("5 0 1 rnorm .s")
#> [[1]]
#> function (n, mean = 0, sd = 1)
#> .Call(C_rnorm, n, mean, sd)
#> <bytecode: 0x55a4321ec390>
#> <environment: namespace:stats>
#>
#> [[2]]
#> [1] 1
#>
#> [[3]]
#> [1] 0
#>
#> [[4]]
#> [1] 5
#>
#> [[5]]
#> NULL
#>
# fr> rnorm ?
loadFrothSession(tf)
froth.parse("5 0 1 rnorm .s")
#> [[1]]
#> function (n, mean = 0, sd = 1)
#> .Call(C_rnorm, n, mean, sd)
#> <bytecode: 0x55a4321ec390>
#> <environment: namespace:stats>
#>
#> [[2]]
#> [1] 1
#>
#> [[3]]
#> [1] 0
#>
#> [[4]]
#> [1] 5
#>
#> [[5]]
#> function (n, mean = 0, sd = 1)
#> .Call(C_rnorm, n, mean, sd)
#> <bytecode: 0x55a4321ec390>
#> <environment: namespace:stats>
#>
#> [[6]]
#> [1] 1
#>
#> [[7]]
#> [1] 0
#>
#> [[8]]
#> [1] 5
#>
#> [[9]]
#> NULL
#>