bMM {nftbart} | R Documentation |
Create a matrix out of a vector or data.frame
Description
Adapted from bartModelMatrix()
. The
compiled functions of this package operate on matrices in memory.
Therefore, if the user submits a vector or data.frame
, then this
function converts it to a matrix. Also, it determines the number of
cutpoints necessary for each column when asked to do so.
Usage
bMM(X, numcut=0L, usequants=FALSE, type=7, xicuts=NULL, rm.const=FALSE,
rm.dupe=FALSE, method="spearman", use="pairwise.complete.obs")
Arguments
X |
A vector or data.frame to create the matrix from. |
numcut |
The maximum number of cutpoints to consider.
If |
usequants |
If |
type |
Determines which quantile algorithm is employed. |
xicuts |
To specify your own cut-points, use the |
rm.const |
To remove constant variables or not. |
rm.dupe |
To remove duplicate variables or not. |
method , use |
Correlation options. |
Value
If numcut==0
(the default), then a matrix of the
covariates is returned; otherwise, a list is returned with the
following values.
X |
A matrix of the covariates with |
numcut |
A vector of length |
grp |
A vector that corresponds to variables in the input
|
dummy |
Corresponds to |
See Also
Examples
set.seed(99)
a <- rbinom(10, 4, 0.4)
table(a)
x <- runif(10)
df <- data.frame(a=factor(a), x=x)
(b <- bMM(df))
(b <- bMM(df, numcut=9))
(b <- bMM(df, numcut=9, usequants=TRUE))
## Not run:
## this is an error
f <- bMM(as.character(a))
## End(Not run)