python (65.1k questions)
javascript (44.2k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (12.9k questions)
is there a simple way to recode levels of a factor variable so that levels occuring below a given frequency are recoded to "other"
theshold <- c(0.001, 0.5, 0.1)
df$a df$b df$c - Recode levels based on level frequency of less than first threshold
df$x df$y df$x - Recode levels based on level frequency of less than second thres...
Damien Conway
Votes: 0
Answers: 3
Recoding with and/or condition across multiple columns
I want to create a new variable (new_var) and condition it off of multiple columns: class == "yes" & score1:score5 >80. I have code that works below but is there a cleaner way to do t...
SaraFormula
Votes: 0
Answers: 1
How to recode a new date variable and select the lowest date out of four date columns in R
Sample data
stack_dat <- structure(list(bio_drug_stop_date = structure(c(15376, NA, 15602, NA, 15550, NA, 15350, 15363, 15418, 16157), class = "Date"),
follow_up_2_years = s...
Pashtun
Votes: 0
Answers: 1
Recode a variable within the mids object of the mice library in R
The following dataset is available
data <- structure(list(asdas_6month = c(23.1222666868239, 25.4056847196073,
25.9886630231065, NA, 26.9450864282904, 15.1832953552198, 22.1618055512694,
NA, 24.1...
Pashtun
Votes: 0
Answers: 1