Title: | Reproducible Research Tools |
---|---|
Description: | Reproducible research tools automates the creation of an analysis directory structure and work flow. There are R markdown skeletons which encapsulate typical analytic work flow steps. Functions will create appropriate modules which may pass data from one step to another. |
Authors: | Brian Fannin [aut, cre] |
Maintainer: | Brian Fannin <[email protected]> |
License: | GPL (>=3) |
Version: | 0.1.3 |
Built: | 2024-11-08 02:56:34 UTC |
Source: | https://github.com/pirategrunt/represtools |
Create an analysis file
Analyze(fileStem, inputFiles, title)
Analyze(fileStem, inputFiles, title)
fileStem |
The file stem |
inputFiles |
A vector of files to load |
title |
Title of the document |
Create a cook file
Cook(fileStem, inputFiles, title)
Cook(fileStem, inputFiles, title)
fileStem |
The file stem |
inputFiles |
A vector of files to load |
title |
Title of the Cook document |
This will apply functions to a vector of objects.
DescribeObjects(objects, FUNS, env)
DescribeObjects(objects, FUNS, env)
objects |
A list of objects to be described |
FUNS |
the functions which will describe the objects |
env |
An enviroment. If missing, the global environment will be used. |
1. Given a vector of objects, apply a vector of functions. This is most common when I want to apply both 'str' and 'summary' to a data frame.
2. How is that implemented in practice? I either want the output printed or I want to capture the output to print later, but I'm not sure. The easiest option would be to print everything.
3. And that's what I'll do.
Describe the objects
This may be used to quickly summarize a set of objects. Note that functions are called for their side effects of printing output
x may be given as a character vector or a list.
## Not run: myFit1 <- lm(myData, y ~ x1 + x2) myFit2 <- lm(myData, y ~ x3) DesribeObjects(list(myFit1, myFit2), broom::tidy) ## End(Not run)
## Not run: myFit1 <- lm(myData, y ~ x1 + x2) myFit2 <- lm(myData, y ~ x3) DesribeObjects(list(myFit1, myFit2), broom::tidy) ## End(Not run)
Create a gather file
Gather(fileStem, title)
Gather(fileStem, title)
fileStem |
The file stem |
title |
Title of the Gather document |
Read a SQL file
GetSQL(filename, warn = FALSE)
GetSQL(filename, warn = FALSE)
filename |
A character variable with a filename |
warn |
Warn if there is a missing final end of line. Default is TRUE |
String
Form a character vector of the names of objects, based on patterns.
ListObjects(patterns = c("^df", "^plt", "^fit"), env)
ListObjects(patterns = c("^df", "^plt", "^fit"), env)
patterns |
A vector of patterns |
env |
An enviroment. If missing, the global environment will be used. |
This will collect objects based on a vector of character patterns.
character vector
This function will load a set of objects stored in .rda files. By default, objects are loaded into the Global environment.
LoadObjects(params, env = .GlobalEnv, loadFiles)
LoadObjects(params, env = .GlobalEnv, loadFiles)
params |
A list of parameters. Should include the named items inputDir and inputFiles. |
env |
An environment in which to load objects. Defaults to the global environment. |
loadFiles |
A character vector of files containing saved data. |
The params object is defined within an RMarkdown file and contains named items "inputDir" and "inputFiles". As an expedient, one may pass a vector of filenames. This vector will only be used if the params argument has been omitted.
Character vector containing the names of loaded objects.
## Not run: loadedObjects <- LoadObjects(params) ## End(Not run)
## Not run: loadedObjects <- LoadObjects(params) ## End(Not run)
This will run the make
program with whatever target the user selects. The default target is "all". The function works by calling
the system2
function. It is presumed that an appropriate make
utilty exists on the user's computer. Further
note that the default makefile for an analysis project uses GNU extensions like wildcards.
Make(target = "all", command = "", ...)
Make(target = "all", command = "", ...)
target |
The make target to run |
command |
User-supplied location of the |
... |
Additional arguments to the |
The function will to try to confirm
## Not run: Make() Make("clean", command = "/usr/bin/gmake") Make("gather") Make("MyFile.rda") ## End(Not run)
## Not run: Make() Make("clean", command = "/usr/bin/gmake") Make("gather") Make("MyFile.rda") ## End(Not run)
Returns a list of the objects named in x
NamesToObjects(x, envir)
NamesToObjects(x, envir)
x |
Vector or list of named objects |
envir |
Environment in which to search |
Return a list of named objects
x is given as either a character vector containing names of objects to return, or a list. If x is a list, it will first be converted to character. If objects do not exist, no error or warning will be generated.
A list of objects
## Not run: mojo <- 4 gonzo <- "Moe" lstObjects <- NamesToObjects(c("mojo", "gonzo")) ## End(Not run)
## Not run: mojo <- 4 gonzo <- "Moe" lstObjects <- NamesToObjects(c("mojo", "gonzo")) ## End(Not run)
Create a new Research
NewResearch(path = ".", RStudio = TRUE, useExistingDirectory = FALSE)
NewResearch(path = ".", RStudio = TRUE, useExistingDirectory = FALSE)
path |
A character variable indicating the name of the project to create |
RStudio |
Boolean indicating whether or not to create an RStudio project. Default is TRUE. |
useExistingDirectory |
Overwrite the directory if it already exists. Default is FALSE. |
NewResearch will invisibly return the name of the project.
Construct an output file from a params list.
OutputFile(params)
OutputFile(params)
params |
List object with output directory and file stem elements |
Create a presentation file
Present(fileStem, inputFiles, title, outputFormat)
Present(fileStem, inputFiles, title, outputFormat)
fileStem |
The file stem |
inputFiles |
A vector of files to load |
title |
Title of the document |
outputFormat |
A string indicating the outputFormat |