r - How do I select parts from a model (Classes?) -


i have fitted model using caret.

i wanted return vector of variables used in model.

here's slimmed down version of mymodel$terms

mod_xgb$terms cluster ~ patrol + investig + assault + alarm + vehicl + complaint +      properti + found + check + theft + suspici + activ + suspici_activ +      crimin + mischief attr(,"variables") list(cluster, patrol, investig, assault, alarm, vehicl, complaint,      properti, found, check, theft, suspici, activ, suspici_activ,      crimin, mischief attr(,"factors")                    patrol investig assault alarm vehicl complaint properti found check theft suspici activ suspici_activ crimin mischief cluster                 0        0       0     0      0         0        0     0     0     0       0     0             0      0        0 patrol                  1        0       0     0      0         0        0     0     0     0       0     0             0      0        0 investig                0        1       0     0      0         0        0     0     0     0       0     0             0      0        0 assault                 0        0       1     0 attr(,"order")  [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [68] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 attr(,"intercept") [1] 1 attr(,"response") [1] 1 attr(,".environment") <environment: r_globalenv> attr(,"predvars") list(cluster, patrol, investig, assault, alarm, vehicl, complaint,      properti, found, check, theft, suspici, activ, suspici_activ,      crimin, mischief attr(,"dataclasses")            cluster             patrol           investig            assault              alarm             vehicl          complaint            "factor"          "numeric"          "numeric"          "numeric"          "numeric"          "numeric"          "numeric"            properti              found              check              theft            suspici              activ      suspici_activ           "numeric"   

here str:

> str(mod_xgb$terms) classes 'terms', 'formula'  language cluster ~ patrol + investig + assault + alarm + vehicl + complaint + properti + found + check + theft + suspici +| __truncated__ ...   ..- attr(*, "variables")= language list(cluster, patrol, investig, assault, alarm, vehicl, complaint, properti, found, check, theft, suspici, activ,| __truncated__ ...   ..- attr(*, "factors")= int [1:96, 1:95] 0 1 0 0 0 0 0 0 0 0 ...   .. ..- attr(*, "dimnames")=list of 2   .. .. ..$ : chr [1:96] "cluster" "patrol" "investig" "assault" ...   .. .. ..$ : chr [1:95] "patrol" "investig" "assault" "alarm" ...   ..- attr(*, "term.labels")= chr [1:95] "patrol" "investig" "assault" "alarm" ...   ..- attr(*, "order")= int [1:95] 1 1 1 1 1 1 1 1 1 1 ...   ..- attr(*, "intercept")= int 1   ..- attr(*, "response")= int 1   ..- attr(*, ".environment")=<environment: r_globalenv>    ..- attr(*, "predvars")= language list(cluster, patrol, investig, assault, alarm, vehicl, complaint, properti, found, check, theft, suspici, activ,| __truncated__ ...   ..- attr(*, "dataclasses")= named chr [1:96] "factor" "numeric" "numeric" "numeric" ...   .. ..- attr(*, "names")= chr [1:96] "cluster" "patrol" "investig" "assault" ... 

i don't understand how subset object. example, in str part above if want access line for:

.. ..- attr(*, "dimnames")=list of 2   .. .. ..$ : chr [1:96] "cluster" "patrol" "investig" "assault" ... 

to dimnames list, how subset object?


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -