source.all: R Utilities: Source all R or 'Rcpp' Files within a Directory

View source: R/source.all.R

source.allR Documentation

R Utilities: Source all R or Rcpp Files within a Directory

Description

The function source.all sources all R files within a specified directory and is based on base::source.

The function source.Rcpp.all sources all Rcpp files within a specified directory and is based on Rcpp::sourceCpp.

The function rcpp_create_header_file creates a cpp header file for a Rcpp file.

Usage

source.all( path, grepstring="\\.R",  print.source=TRUE, file_sep="__"  )

source.Rcpp.all( path, file_names=NULL, ext="\\.cpp", excl="RcppExports",
   remove_temp_file=FALSE )

rcpp_create_header_file(file_name, pack=NULL, path=getwd() )

Arguments

path

Path where the files are located

grepstring

Which strings should be looked for? grepstring can also be a vector.

print.source

An optional logical whether the source process printed on the console?

file_sep

String at which file name should be split for looking for most recent files

file_names

Optional vector of (parts of) file names

ext

File extension for Rcpp files

excl

String indicating which files should be omitted from sourcing

remove_temp_file

Logical indicating whether temporary Rcpp files should be removed.

file_name

File name

pack

Optional string for package

Details

For loading header files, the line // [include_header_file] has to be included before loading the header file using a line of the form #include "my_function.h".

Examples

## Not run: 
# define path
path <- "c:/myfiles/"
# source all files containing the string 'Rex'
source.all( path, "Rex" )

## End(Not run)

miceadds documentation built on Jan. 7, 2023, 1:09 a.m.