Utilities | R Documentation |
Miscellaneous functions, some used mainly internally in the package, but of possible use externally.
buildQEcall(qeFtnName,dataName,yName=NULL,opts=NULL,holdout=NULL,
holdoutArg=TRUE)
evalr(toexec)
newDFRow(dta,yName,x,dtaRowNum=1)
replicMeansMatrix(nReps,cmd,nCols=NULL)
Data(datasetName)
wideToLongWithTime(data,timeColName,timeColPresent=TRUE,
timeColSeq=c(1,1),grpColName=NULL,valueColName=NULL)
data |
Data frame or equivalent. Other than a "time" column, all columns must be numeric, one column per group (see below). |
qeFtnName |
Quoted name of a qeML predictive function. |
dataName |
Quoted name of a data frame. |
yName |
Quoted name of a column to be predicted. |
opts |
Non-default arguments for the function specified
in |
holdout |
Size of holdout set, if any. |
holdoutArg |
A value TRUE means the function specified in
|
toexec |
Quoted string containing an R function call. |
nReps |
Number of replications. |
cmd |
Quoted string containing an R function call. If multiple statements, enclose with braces. |
nCols |
Number of columns for output. |
dta |
A data frame. |
x |
An R list specifying fields to be set. |
dtaRowNum |
Row number in 'dta' to be used as a basis. |
datasetName |
Quoted string of dataset to be loaded. |
The function qeFtnName
does what its name implies: It assembles
a string consisting of a qeML function call. Typically the latter
is then executed via evalr. See for instance the source code of
qeLeaveOut1Var
.
R's generic predict
function generally required that the input
rows match the original training data in name and class. The
newDFRow
function can be used to construct such a row.
The function replicMeansMatrix
will eventually replace
regtools::replicMeans
. It runs the specified code many times,
with the code assumed to have some random component such as in
simulation or in investigation of a random algorithm.
The function Data
is a convenience function that combines calls
to data
and str
.
The function wideToLongWithTime
plot "Y" versus "X" for different
groups, one per column in data
other than "X", if present. "X" is
typically time but can be any ordered numeric quantity. If "X" is not
present, the arguments specify how the user wants one created.
Norm Matloff
# function to list all the objects loaded by the specified package
lsp <- function(pkg) {
cmd <- paste('ls(package:',pkg,')')
evalr(cmd)
}
lsp('regtools')
# outputs
# [1] "clusterApply" "clusterApplyLB" "clusterCall"
# [4] "clusterEvalQ" "clusterExport" "clusterMap"
# ...
# mean of scalar quantity
replicMeansMatrix(1000,'rnorm(1)^2')
# mean of vector quantity
replicMeansMatrix(1000,'c(rnorm(1),rnorm(1)^2)',2)
# mean of matrix quantity
replicMeansMatrix(1000,
'{z1=rnorm(1); z2=rnorm(1); x=z1; y=z1+z2; rbind(c(x,x^2),c(y,y^2))}',2)
data(currency)
zLong <- wideToLongWithTime(currency,'weeknum',timeColPresent=FALSE,
grpColName='country',valueColName='rate')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.