[R] Random Forest for multiple categorical variables

Liaw, Andy andy_liaw at merck.com
Wed Oct 17 20:32:27 CEST 2012


How about taking the combination of the two?  E.g., gamma = factor(paste(alpha, beta1, sep=":")) and use gamma as the response.

Best,
Andy
 

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Gyanendra Pokharel
Sent: Tuesday, October 16, 2012 10:47 PM
To: R-help at r-project.org
Subject: [R] Random Forest for multiple categorical variables

Dear all,

I have the following data set.

V1  V2  V3  V4  V5  V6  V7  V8  V9  V10  alpha   beta
1    11    1   11    1   11    1   11    1    11    alpha   beta1
2    12    2   12    2   12   2   12    2    12    alpha  beta1
3    13    3   13    3   13   3   13     3    13    alpha   beta1
4    14    4   14    4    14  4   14    4     14   alpha   beta1
5    15    5   15    5    15  5   15    5     15   alpha   beta1
6    16    6    16    6   16   6  16    6     16   alpha   beta2
7    17    7    17    7    17  7   17   7     17   alpha   beta2
8    18    8   18     8    18  8    18   8    18    alpha  beta2
9    19    9    19    9    19  9     19   9   19    alpha   beta2
10   20   10   20   10   20  10   20  10  20  alpha   beta2

I want to use the randomForest classification. If there is one categorical
variable with different classes, we can use

randomForest(resp~., data, ........), but here I need to classify the data
with two categorical variables. Any idea will be great.

Thanks

	[[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Notice:  This e-mail message, together with any attachme...{{dropped:11}}




More information about the R-help mailing list