README.md

dirr

Purpose

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.

Installation

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")

How to Use

Create project directories

  1. Create a new project folder, in RStudio or other
  2. Load the dirr package
  3. Run the make_dirs function
libryar(dirr)

make_dirs()

Output

The following folders are created by make_dirs:

Compress data files

  1. Load the dirr package
  2. Run the gzip_files function to compress all data files in the data/raw directory, or other specified directory
library(dirr)

gzip_files()

Batch read and save Rds files

  1. Load the dirr package
  2. Run the save_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 argument
  3. Use get_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")


bgulbis/dirr documentation built on June 22, 2019, 10:52 p.m.