[R] setting serialization

Glenn Schultz g|ennm@chu|tz @end|ng |rom me@com
Sat Apr 11 15:52:54 CEST 2020


All,

I have a set up as shown below.  Everything works fine but the new serialization default is 3, I would like it to serialize to version = 2.  I've tried a couple of different ways to set version and googled around but so far I've had no luck.  The package builds fine but then sets dependency to R(>= 3.5.0) this no backward compatibility.  Actually, I don't mind this personally but is there a way with the below set-up to avoid this?

Best,
Glenn

zzz.r file as below
       .onAttach <- function(libname, pkgname){
      packageStartupMessage(
      "Bond Lab is a registered trademark of Bond Lab Technologies.")
      BondLabSetUp()
      }

A file in my inst directory with functions that I serialize on load an example of which is below.
         Scenario(
         Name = "NCs",
         Type = "Immediate",
         ShiftType = "Parallel",
         Shiftbps = "0",
         Formula = function(rates.data = vector(), Shiftbps = "character"){
         yield.basis = 100
         pmax(0.01, as.numeric(rates.data) + (as.numeric(Shiftbps)/yield.basis))
         })

A .R file BondLabSetUp.R #' Setup function for the R package BondLab to create the needed objects
#' 
#' @export
BondLabSetUp <- function(){

do.call(source, 
list(file = paste(system.file(package = "BondLab"), 
"/Scenario/Scenario_SpotCurve", sep = ""),
local = TRUE))



More information about the R-help mailing list