strengejacke / sjmisc

Data transformation and utility functions for R

Home Page:https://strengejacke.github.io/sjmisc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Important bug in Rec

andresimi opened this issue · comments

I think this is a bug.

library(sjmisc)

> rec(4, rec = "min:5=low; 6:10=high")
[1] "low"
> rec(4, rec = "min:5=low; 6:max=high")
[1] "high"

Hi, I noticed that something has changed but I am not understanding the rec behavior. Is something wrong with my code?

> library(sjmisc)
> rec(4, rec = "min:5=low; 6:10=high")
[1] "low"
> rec(4, rec = "min:5=low; 6:max=high")
Erro: ?Syntax error in recode range from 6 to 4.
> rec(4, rec = "min:5=low; max:6=high")
[1] "high"

Your highest number is 4, but you request a range from 6 to highest number. This is not possible, since the 6 is larger than the highest number, 4.