Re: [R] how to recode in my dataset?

From: ronggui <ronggui.huang_at_gmail.com>
Date: Mon 03 Jul 2006 - 14:33:25 EST

I always use "recode" function (in the car packages) to recode variables.That works well and I like that function.

2006/7/2, zhijie zhang <epistat@gmail.com>:
> Dear Rusers,
> My question is about "recode variables". First, i'd like to say
> something about the idea of recoding:
> My dataset have three variables:type,soiltem and airtem,which means
> grass type, soil temperature and air temperature. As we all known, the
> change of air temperature is greater than soil temperature,so the
> values in those two different temperaturemay represent different
> range.
> My recoding is to recode soiltem with 0.2 intervals, and airtem with
> 0.5 intervals, that is:
> In soiltem:0~0.2<-0.1, 0.2~0.4<-0.3, 0.4`0.6<-0.5,...etc;
> In airtem:0~0.5<-0.25, 0.5~1<-0.75, 1`1.5<-1.25,...etc;
> My example like this:
> type<-c(1, 1, 2, 3,4,1,1,4,3,2)
> soiltem<-c(19.2,18.6,19.5,19.8,19.6,20.6,19.1,18.7,22.4,21.6)
> airtem<-c(19.9,20.5,21.6,25.6,22.6,21.3,23.7,21.5,24.7,24.4)
> mydata<-data.frame(type,soiltem,airtem) #copy the above four arguments
> to generate the dataset
>
> mydata
> type soiltem airtem
> 1 1 19.2 19.9
> 2 1 18.6 20.5
> 3 2 19.5 21.6
> 4 3 19.8 25.6
> 5 4 19.6 22.6
> 6 1 20.6 21.3
> 7 1 19.1 23.7
> 8 4 18.7 21.5
> 9 3 22.4 24.7
> 10 2 21.6 24.4
>
> Thanks very much!
> --
> Kind Regards,
> Zhi Jie,Zhang ,PHD
> Department of Epidemiology
> School of Public Health
> Fudan University
> Tel:86-21-54237149
>
> ______________________________________________
> R-help@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
>

-- 
ٹ
Department of Sociology
Fudan University



______________________________________________ R-help@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

Received on Mon Jul 03 14:40:45 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 03 Jul 2006 - 16:14:36 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.