R Under development (unstable) (2024-01-28 r85838 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 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. > library("R.rsp") R.rsp v0.46.0 successfully loaded. See ?R.rsp for help. > > path <- system.file("exData", package="R.rsp") > pathname <- rfile("random.txt.rsp", path=path) > print(pathname) RspFileProduct: Pathname: d:/RCompile/CRANincoming/R-devel/R.rsp.Rcheck/tests/random.txt File size: 33 bytes Content type: text/plain Has processor: FALSE > > lines <- readLines(pathname, warn=FALSE) > cat(lines, collapse="\n") A random integer in [1,100]: 20 > > file.remove(pathname) [1] TRUE > > > # Passing arguments > path <- system.file("exData", package="R.rsp") > pathname <- rfile("random-args.txt.rsp", path=path, args=list(K=50)) > print(pathname) RspFileProduct: Pathname: d:/RCompile/CRANincoming/R-devel/R.rsp.Rcheck/tests/random-args.txt File size: 32 bytes Content type: text/plain Has processor: FALSE > > lines <- readLines(pathname, warn=FALSE) > cat(lines, collapse="\n") A random integer in [1,50]: 16 > > file.remove(pathname) [1] TRUE > > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > # Various host content types > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > path <- system.file("exData", package="R.rsp") > filenames <- list.files(pattern="LoremIpsum.*.rsp$", path=path) > for (filename in filenames) { + print(filename) + pathname <- rfile(filename, path=path, verbose = TRUE) + print(pathname) + file.remove(pathname) + } > > proc.time() user system elapsed 0.62 0.14 0.75