Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Meaning of lo: in R

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading