0

I have clinical data with:

Type, Age, Sex
One, 24, M
Two, 45, F
One, 48, M
.
.
.

I would like to use R to show some useful plots, for example a box plot.

I would like to have Type on the x-axis and Age on the y-axis with vertical boxes, but also split by Sex, so separate for male and female but grouped by Type.

My first try is:

DATA_SET <- read.csv("myfile.csv")
x <- DATA_SET[,'Type']
y <- DATA_SET[,'Age']
plot(x,y)

It's quite okay but I would like to add titles to each axis and have more values (be more acurate for readers) on the y-axis. And most importantly, split each box into two--separate for male and female.

Alex A.
  • 5,466
  • 4
  • 26
  • 56
jano
  • 1
  • This [link](http://www.statmethods.net/advgraphs/layout.html) should serve as a starting point. Also look at the `facet_wrap` function in ggplot2. – figurine Apr 27 '15 at 21:34
  • This question is very broad, not very clear, and the title doesn't seem to match the question. It sounds like you want _separate_ plots for _one_ variable, rather than _one_ plot for _multiple_ variables. – Alex A. Apr 27 '15 at 21:52
  • I would like to have values fro two y sets (age) and one x set (types) on the same plot – jano Apr 27 '15 at 21:55
  • http://stackoverflow.com/questions/6142944/how-can-i-plot-with-2-different-y-axes – MineSweeper Apr 28 '15 at 00:14

0 Answers0