Convert: Convert

Description Usage Arguments Details Value See Also Examples

View source: R/Convert.R

Description

This functions converts a matrix according to a supplied data.frame. This can be used to convert an analytics base table into a structure which matches to a saved model.

Usage

1
Convert(abt, feats, ref)

Arguments

abt

num matrix which should be converted

feats

data.frame with columns name and value which identifies the columns of abt with chr values

ref

data.frame with columns name and value which identifies the columns of the desired matrix with chr values (columns missing in abt will be 0)

Details

Matrix columns are identified with a data.frame with columns name and value. name:value must be unique in the data.frame. Columns of matrix abt are identified by feats. abt is converted into a matrix of the form described with ref. Columns identified in ref not appearing in feats will be filled with 0's.

Value

num matrix with columns as identified in ref

See Also

Other machine learning: CV, FeatureExtraction, Prediction, Training

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
abt1 <- matrix(1:20, 5,4)
feats1 <- data.frame(
  name = letters[1:4], 
  value = letters[1:4]
)
feats2 <- data.frame(
  name = rep(letters[1:2], 2), 
  value = rep(letters[1:2], each = 2)
)
Convert(abt1, feats1, feats2)

mRcSchwering/abacus documentation built on May 21, 2019, 9:18 a.m.