Description Usage Arguments Details Value See Also Examples
View source: R/carrot_functions.R
Function which turns a set of predictors containing nonnumeric variables into a fully numeric set
1  make_numeric_sets(a,ai,k,vari,ra,l,mode)

a 
An M x N matrix, containing all possible subsets (N overall) of the size M of predictors' indices; therefore each column of 
ai 
array of indices of the array 
k 
index of the array 
vari 
set of all predictors 
ra 
array of sample indices of 
l 
size of the sample 
mode 

Function transforms the whole set of predictors into a numeric set by consecutively calling function make_numeric
for each predictor
Returns a list containing two objects: tr
and test
tr 
training set transformed into a numeric one 
test 
test set transformed into a numeric one 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22  #creating a categorical numeric variable
a<t(rmultinom(100,1,c(0.2,0.3,0.5)))%*%c(1,2,3)
#creating an analogous nonnumeric variable
c<array(NA,100)
c[a==1]='red'
c[a==2]='green'
c[a==3]='blue'
#creating a dataset
b<data.frame(matrix(c(a,rbinom(100,1,0.3),runif(100,0,1)),ncol=3))
#making the first column of the dataset nonnumeric
b[,1]=data.frame(c)
#running the function
make_numeric_sets(combn(3,2),1:3,1,b,sample(1:100,60),100,"binary")

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.