[R] r syntax
gunter.berton at gene.com
Sun Apr 28 04:21:14 CEST 2013
But there is almost certainly no need to do this in the first place!
On Sat, Apr 27, 2013 at 3:57 PM, Rui Barradas <ruipbarradas at sapo.pt> wrote:
> You should provide us with a data example.
> In the following, the two solutions are completely different but both of
> them do what you want. Note that the second creates a factor variable, whose
> levels are coded as integers. See R-intro.pdf in your doc directory, chapter
> 4 Ordered and unordered factors.
> x <- sample(c("Male", "Female"), 10, replace = TRUE)
> y1 <- ifelse(x == "Male", 1L, 2L)
> y2 <- factor(x, levels = c("Male", "Female"))
> Hope this helps,
> Rui Barradas
> Em 27-04-2013 15:32, sgs sys escreveu:
>> i want to recode Male =1 and female =2 in R
>> what is the syntax for same ?
>> [[alternative HTML version deleted]]
>> R-help at r-project.org mailing list
>> PLEASE do read the posting guide
>> and provide commented, minimal, self-contained, reproducible code.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Genentech Nonclinical Biostatistics
Internal Contact Info:
More information about the R-help