0

I'm fairly new to R, here is the code below:

volume <- c(388,499,477,408,480,559,347,995,303,506,402,285,360,327,222,452,385,369,541,257,349,503,227,410,254,229,328,377,292,546,195,336,367)
stage <- c(rep("baseline",11),rep("preRT",11),rep("postRT",11))
prostatic_volume <- data.frame(volume,stage)

plot(volume ~ stage, 
     data=prostatic_volume,
     main="Change in prostatic volume during treatment",
     ylab="Prostatic volume, #voxels")

I want it to plot in the order of baseline, preRt, postRt. But for some reason it mixes up the order of preRT and postRT.

Any ideas how I can fix this?

Thanks in advance :)

0

1 Answer 1

0

Data frame can be corrected before plotting:

prostatic_volume$stage = factor(stage, levels=c('baseline','preRT','postRT'))

Not the answer you're looking for? Browse other questions tagged or ask your own question.