Description Usage Arguments Examples
View source: R/aplica_agrupaciones.R
apply groups to a table .
1 | aplica_agrupaciones(tbla_result, tbla_grupos, nombre_variable)
|
tbla_result |
table with data. It has to have the variable . |
tbla_grupos |
table with groups. |
nombre_variable |
name of the variable to group. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | set.seed(1)
x1 = rnorm(1000)
x2 = rnorm(1000)
x4='A'
x4=ifelse(x1>0.1,'B', x4)
x4=ifelse(x1>0.4,'C', x4 )
x4=ifelse(x1>0.6,'D', x4 )
x4=ifelse(x1>0.8,'E', x4 )
z = 1 + 3*x1
pr = 1/(1+exp(-z))
y = rbinom(1000,1,pr)
tbla = data.frame(y=y,x1=x1,x2=x2, x4=x4)
q_nas=100
x1[1:q_nas] = NA
x4[1:q_nas]=NA
a<- agrupa_ctree (tbla, target_name='y', variable_name='x4',flag_numerica=0 , algoritmo='chaid' )
aplica_agrupaciones(tbla_result = tbla, tbla_grupos = a, 'x4')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.