[R] how to change automatically 0=no and 1=yes
Sean Davis
sdavis2 at mail.nih.gov
Wed Jun 15 16:06:02 CEST 2005
> 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
> 0 0 0 1 1 0 0 1 1
> 1 0 0 1 1 0 0 1 1
> 0 1 0 1 1 0 0 1 1
> 1 1 0 1 1 0 0 1 1
> ...
> How can I change automatically 0=no and 1=yes.
>
> Thank you very much in advance.
> Kindly regards,
> Muhammad Subianto
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
More information about the R-help
mailing list