Workspace: Workspace

Description Usage Format Value Fields Methods Author(s) Examples

Description

Workspace

Usage

1

Format

R6Class object.

Value

Object of R6Class with methods to easy create and update an R package.

Fields

root

character. Stores absolute path of working root directory.

Methods

new(Xroot = getwd())

This method is used to create object of this class with Xroot as absolute path for working root directory.

folderCreate(XfolderList)

This method create folders (dir.create) given a list of paths (relative with respect to Xroot) by folderList parameter.

fileCreate(XfileList)

This method create files (file.create) given a list of paths (relative with respect to Xroot) by fileList parameter.

fileList(Xfolder='', Xpattern = '*', Xfull = TRUE, Xrecursive = FALSE)

This method returns a vector of relative paths (if Xfull = FALSE return filenames). Regex filters can be applied by Xpattern argument.

fileCopy(XfileList, Xfolder)

This method copy a list of files into a folder. All paths relative to self$root.

gitInit(Xfolder)

This method initialize (init && add –all && commit -m "Init") a git repository in a given Xfolder.

gitCommit(Xfolder, Xmessage)

The method commit (add . && commit -m "Xmessage") the git repository in a given Xfolder.

libraryCreate(Xlibrary)

This method creates skeleton package with create() function from roxygen2, adds forlder to complete the package skeleton and runs gitInit().

libraryUpdate(Xlibrary)

This method updates package documentation (with document() function from roxygen2), creates a pfd manual, builds and installs the package and runs gitCommit().

readAllFiles(Xpath, Xpattern = '*.csv', Xbind = TRUE, X2env = TRUE)

This method import all files in a folder and returns a only data.table. If Xbind = FALSE returns a list of data.table with the same name than files and save in Global Environment. If X2env = FALSE returns a named list of data.table.

rd2pdf(Xtitle, Xoutput, Xinput)

This method coverts an Xinput Rd file into Xoutput pdf with Xtitle from Xroot.

runSystem(Xcommand)

This method run bash command typed in Xcommand from self$root.

Author(s)

Joan D<c3><ad>dac Viana Fons joanvianafons@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Instance at current working directory
w = Workspace$new(getwd())
# Create a package skeleton (roxygen2::create()),
# git init, copy some files,
# set documentation (devtools::document()),
# git commit and install
name = 'newLibrary'
# Create a Workspace object at working root directory (\code{getwd()})
w = Workspace$new()
# Create a library skeleton and git init
w$libraryCreate(name)
# Generate Rd documentation, pdf manual, build, install and git commit
w$libraryUpdate(name, 'version 0.0.0.9')

JoanViana/devR documentation built on May 7, 2019, 11:15 a.m.