matBack2OrgClass: Coerce a matrix (back) to 'class' of some other object

Description Usage Arguments Value Author(s) See Also Examples

Description

Coerce a matrix (back) to class of some other object

Usage

1
2
3
4
5
6
## S3 method for class 'numdfr'
matBack2OrgClass(objWithClass, mat, catCols, levelList, ord=rep(FALSE, ncol(mat)),
	colnms=NULL, verbosity=0)
## S3 method for class 'data.frame'
matBack2OrgClass(objWithClass, mat, catCols, levelList, ord=rep(FALSE, ncol(mat)),
	colnms=NULL, verbosity=0)

Arguments

objWithClass

object to dispatch class upon

mat

matrix to coerce (back) to format/class of objWithClass

catCols

indices of categorical columns

levelList

list of character vectors holding the labels for categorical columns

ord

logical vector indicating whether each column is an ordered factor

colnms

columnn names to use (if not the original ones - default is NULL)

verbosity

The higher this value, the more levels of progress and debug information is displayed (note: in R for Windows, turn off buffered output)

Value

object of the same class as objWithClass

Author(s)

Nick Sabbe

See Also

NumDfr, as.matrix

Examples

1
2
3
4
5
6
7
8
9
iris.nd<-numdfr(iris)
irismat<-as.nummatrix(iris)
irismat<-irismat[sample(nrow(irismat), 20, replace=TRUE),]
rownames(irismat)<-seq(20)

ccs<-which(sapply(iris, is.factor))
lvls<-allLevels(iris, onlyNonEmpty=TRUE)
matBack2OrgClass(iris, irismat, catCols=ccs, levelList=lvls, verbosity=5)
matBack2OrgClass(iris.nd, irismat, catCols=ccs, levelList=lvls, verbosity=5)

NumDfr documentation built on May 2, 2019, 5:50 p.m.