I have this data:
# R> smokeyes_male
LungCap.cc. Age..years. Height.inches. Smoke Gender Caesarean
211 6.575 10 63.2 yes male yes
220 7.000 10 62.8 yes male yes
252 9.350 11 71.2 yes male no
258 7.925 11 67.1 yes male no
280 10.275 11 72.2 yes male no
285 8.925 11 65.6 yes male yes
305 6.450 12 61.0 yes male yes
345 8.000 12 64.5 yes male no
370 9.750 13 72.8 yes male no
371 8.025 13 66.2 yes male no
I need to plot a relationship between lung capacity and age with respect to the height of the person or whether the person is Caesarean or not.
I get the following error:
library(ggplot2)
smoker_male_graph=ggplot(smokeyes_male,aes(x=smokeyes_male$age,y=smokeyes_male$LungCap.cc.)) + geom_point()
smoker_male_graph + facet_wrap(~smokeyes_male$Height.inches.)
Error: Aesthetics must be either length 1 or the same as the data (33): x, y
Here is the code:
smokeyes_male <- structure(list(LungCap.cc. = c(6.575, 7, 9.35, 7.925, 10.275,
8.925, 6.45, 8, 9.75, 8.025), Age..years. = c(10L, 10L, 11L,
11L, 11L, 11L, 12L, 12L, 13L, 13L), Height.inches. = c(63.2,
62.8, 71.2, 67.1, 72.2, 65.6, 61, 64.5, 72.8, 66.2), Smoke = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "yes", class = "factor"),
Gender = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L), .Label = "male", class = "factor"), Caesarean = structure(c(2L,
2L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L), .Label = c("no", "yes"
), class = "factor")), .Names = c("LungCap.cc.", "Age..years.",
"Height.inches.", "Smoke", "Gender", "Caesarean"), class = "data.frame", row.names = c("211",
"220", "252", "258", "280", "285", "305", "345", "370", "371"
))