Reputation: 3396
I have a boxplot looking like this :
Boxplot( ~ km_piste, data=slide, id.method="y", col="orange")
The outliers name are shown because I set up the first column as:
row.names(slide) <- as.character(slide$data_name)
Now I would like to know how to make a new multiple boxplot. I would like to have 2 boxplot on the same image. The datas are still in the slide database. The name of the 2 columns are :
I can't figure out how to put the 2 boxplot on the same image with showing :
Edit: here is a link of a my database slide
Upvotes: 0
Views: 1524
Reputation: 263301
The second argument to car::Boxplot is 'g' for use as a grouping variable. At the moment we cannot tell what your dataframe looks like and it sounds as though it might not be in the long format which Boxplot expects. If there were a single column say "area_type" that had values of "ski_parc" and "snow_parc" you could use this format:
Boxplot( ~ km_piste, g= area_type, data=slide, id.method="y", col=c("orange", "red") )
The use of na.omit
had nothing to do with the labeling of the points. It was the choice to use id.method="y"
. When there are multiple groups the x-axis gets labeled with their levels.
Try this:
snow_parc <- data.frame(parc =c(slides$snow_parc, slides$ski_parc),
type=rep(c("snow_parc", "ski_parc"), each=40))
Boxplot(parc~type, data=snow_parc, id.method = "y")
(There were no outliers.)
Upvotes: 2