Usually, we use print
or message
for saving
intermediate results of an R script. This is not graceful.
rrporter
help you do it.
install.packages("rrporter")
library(rrporter)
report <- Report() # initialize report object
add(report, "foo", "bar") # add variable to report
store(report) # save report to file
print(report$report_id) # you need this report ID only.
In another script:
library(rreporter)
report_id <- "xxx" # the ID you want to read
report <- Report(report_id) # initialize using ID
report <- read(report) # load from backend
access(report, "foo") # will return "bar"
rrporter
save to report data to current diretory, there're 2 ways to change it:
- define environment variable
REPORTER_DIR
export REPORTER_DIR=/path/to/reporter
- custom backend object
backend <- FileBackend("/path/to/reporter")
report <- Report(backend = backend)