The datafile package is build around the philosophy that data should be seperated from code. This means that data is always written to a different location (directory) than your current working directory.
You can install the github version of this package with
devtools::install_github("jspijker/datafile")
In this example we create a datadirectory using datafileInit() under the current working directory. Then we created some variable x. And using saveRDS and datafile we save it to disk. The final RDS file is now saved to /tmp/Rtmp.....//data/x.rds.
datafileInit(basedir=tempdir())
x<-rnorm(10)
saveRDS(x,datafile("x.rds"))
To retrieve the rds file, we use:
x<-readRDS(datafile("x.rds"))
If even datafile is to much typing for you, you can use the alias dfn()
x<-readRDS(dfn("x.rds"))
Please see the vignette for more examples how to use this function.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.