Jan Ivanouw wrote:
> I am sorry for my lack of knowledge.
>
> I have a data frame with a variable (column) containing the integers 1,
> 2, 3, 4 and 5.
> I want to recode the variable so 5=1, 4=2, 3=3, 2=4 and 1=5.
>
> How do I do that?
> X <- sample(1:5, 20, replace=TRUE)
> X
[1] 4 1 2 1 2 1 3 4 3 1 2 2 5 5 3 5 3 5 1 3
> 6 - X
[1] 2 5 4 5 4 5 3 2 3 5 4 4 1 1 3 1 3 1 5 3
> Jan Ivanouw PhD
> Dep of Health Psychology
> University of Copenhagen
> Denmark
>
>
> --------------------------------------------------------------------
> This message was distributed by s-news@lists.biostat.wustl.edu. To
> unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
> the BODY of the message: unsubscribe s-news
--
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894
|