Displaying 1 result from an estimated 1 matches for "quartile_variable".
2012 Oct 17
2
loop of quartile groups
...y with the following
code:
brks <- with(data_variables,
cut2(var2, g=4))
#I don't want the actual numbers, I need a numbered group
data$test1=factor(brks, labels=1:4)
However, I cannot get a loop to work nor can I get a loop to add the
columns with an appropriate name (ex. quartile_variable). I have tried
multiple different ways but can't seem to get it to work. I think it would
begin something like this:
for(i in 11:ncol(survival_data_variables)){
brks=as.data.frame(with(survival_data_variables,
cut2(survival_data_variables[,i], g=4)))
Any assistance...