getInputFiles | R Documentation |
These functions analyze R code to find the names of the files
in R calls that read or write data or plots.
The functions find all calls to functions known to read or write
data or create file-based graphics output.
One can identify the names of functions to be considered
and also use findReadDataFuns
,
findWriteDataFuns
,
findGraphicsDevFuns
to analyze other functions to see if they call these primitive
functions and so include those functions as targets.
getInputFiles(x, lang = TRUE, ..., .funNames = getReadDataFuns(...))
getOutputFiles(x, lang = TRUE, ..., .funNames = getOutputDataFuns(...))
getGraphicsOutputFiles(x, lang = TRUE, ..., .funNames = getGraphicsDevFuns(...))
x |
a character vector of R file or directory names, an expression
from parsing an R script, the output from |
lang |
a logical value. If |
... |
a collection of |
.funNames |
the list of function-parameter(s) pairs identifying the functions writing to a file/connection. |
a character vector or list. Where the functions operate on literal file names, a string is returned. Where the call operates on a variable or call that is not known to be a constant, the (rstatic) language object is returned.
Duncan Temple Lang
findReadDataFuns
,
findWriteDataFuns
,
findGraphicsDevFuns
f = system.file("sampleCode/inputFiles.R", package = "CodeAnalysis")
getInputFiles(f)
# includes a call to sprintf()
getInputFiles(f, lang = FALSE)
# NA in place of the sprintf()
## Not run:
# Project from git@github.com:mespe/Variety_trial_analysis.git
ff = list.files("~/Book/ExploreCode/Variety_trial_analysis/code", pattern = "\.R$", full = TRUE)
inp = lapply(ff, getInputFiles, FALSE)
names(inp) = basename(ff)
out = lapply(ff, getOutputFiles, FALSE)
names(out) = basename(ff)
grout = lapply(ff, getGraphicsOutputFiles, FALSE)
names(grout) = basename(ff)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.