Home > Net >  Meaning of lo: in R
Meaning of lo: in R

Time:10-04

I have this example of adding a new table attribute(IMCmod) that tells you if the variable IMD is lesser than 22 in one of the pdfs in my class:

TE<-data.frame(TE,IMCmod=recode(TE$IMC,"lo:22=1;else=0"))

So, my question is does the lo: mean ¨lesser than¨ and if it does, what's the codeword for ¨greater than¨

PD: I feel like it's a dumb question to ask here, but I haven't been able to find it anywhere, so please bear with me.

CodePudding user response:

If you're using the recode function from the car package, lo stands for the lowest value of the variable, so "lo:22=1;else=0" means "all values from the lowest to 22 are recoded to 1; others are recoded to 0".

Note that x:y means the entire range from x to y, it's not the sequence operator as in R code, so 3.1415 would be included as long as the lowest value was smaller.

You can use hi for the highest value.

For more details, see ?recode.

  •  Tags:  
  • r
  • Related