R Under development (unstable) (2025-12-17 r89193 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # Use a temporary directory ---------------------------- > owd = getwd() > td = tempdir() > setwd(td) > > # Do some data encoding and decoding ------------------ > library(knitrdata) > > x = data.frame(a=1:5,b=letters[1:5]) > write.csv(x,"test.csv") > saveRDS(x,"test.RDS") > > enccsv = data_encode("test.csv","base64") > encrds = data_encode("test.RDS","base64") > > csv = data_decode(enccsv,"base64",as_text=TRUE) > cat(csv) "","a","b" "1",1,"a" "2",2,"b" "3",3,"c" "4",4,"d" "5",5,"e" > > rds = data_decode(encrds,"base64",as_text=FALSE) > writeBin(rds,"test_output.RDS") > y = readRDS("test_output.RDS") > y a b 1 1 a 2 2 b 3 3 c 4 4 d 5 5 e > > params = list(run_gpg=FALSE) > if (requireNamespace("gpg") && params$run_gpg) { + k = gpg::gpg_keygen("test","test@test.org") + encgpg = data_encode("test.csv","gpg",options = list(receiver=k)) + + cat(data_decode(encgpg,"gpg",as_text=TRUE)) + + gpg::gpg_delete(k,secret=TRUE) + } Loading required namespace: gpg > > # Cleanup ------------------------------------ > file.remove("test.csv","test.RDS","test_output.RDS") [1] TRUE TRUE TRUE > > setwd(owd) > > proc.time() user system elapsed 0.26 0.09 0.78