knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" )
The dirr
package can be used to set up a data project with default folders. Additionally, utility functions to compress data files and batch load/save Rds are provided.
The dirr
package can be installed from GitHub using the devtools
package and the following commands:
# install.packages("devtools") library(devtools) install_github("bgulbis\dirr")
dirr
packagemake_dirs
functionlibryar(dirr) make_dirs()
The following folders are created by make_dirs
:
dirr
packagegzip_files
function to compress all data files in the data/raw
directory, or other specified directorylibrary(dirr) gzip_files()
pattern
argument to specify only certain files for zippingungzip_files
to uncompress all data filesdirr
packagesave_rds
function to save all R objects in the Global Environment whose names match the regular expression passed to the pattern
argument. The directory where the files are saved is specified by the data.dir
argumentget_rds
to load all files in the specified directory.library(dirr) # save all objects that begin with "tidy" save_rds(data.dir = "data/tidy", pattern = "^tidy") # read all Rds files get_rds(data.dir = "data/tidy")
file.ext
argument should be left as default.Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.