Dear R-helpers,
I have dataset (data.frame) like below,
x1 x2 x3 x4 x5 x6 x7 x8 x9 ... x1200
000110011
100110011
010110011
110110011
...
How
x - data.frame(matrix(c(1,0,1,0,1,1),nrow=3))
x[x==0] - 'no'
x[x==1] - 'yes'
x
X1 X2
1 yes no
2 no yes
3 yes yes
On Jun 15, 2005, at 9:58 AM, Muhammad Subianto wrote:
Dear R-helpers,
I have dataset (data.frame) like below,
x1 x2 x3 x4 x5 x6 x7 x8 x9 ... x1200
@stat.math.ethz.ch
Sent: Wednesday, June 15, 2005 3:58 PM
Subject: [R] how to change automatically 0=no and 1=yes
Dear R-helpers,
I have dataset (data.frame) like below,
x1 x2 x3 x4 x5 x6 x7 x8 x9 ... x1200
000110011
100110011
On Wed, 2005-06-15 at 15:58 +0200, Muhammad Subianto wrote:
Dear R-helpers,
I have dataset (data.frame) like below,
x1 x2 x3 x4 x5 x6 x7 x8 x9 ... x1200
000110011
100110011
010110
Dear all,
Sean Davis, Dimitris Rizopoulos and Marc Schwartz, thanks for your great
help. It works perfectly. Thanks a lot.
All the best,
Muhammad Subianto
On this day 6/15/2005 4:06 PM, Sean Davis wrote:
x - data.frame(matrix(c(1,0,1,0,1,1),nrow=3))
x[x==0] - 'no'
x[x==1] - 'yes'
One thing to be careful of is that we likely intend to
represent the columns of the data frame as factors in which
case we still want the levels to be No and Yes even if a
column only consists of one level (i.e. all No or all Yes).
Note that one solution specifically provided for that.
On