Issues with labelling in all plots

Description of issue -
boxplot(mtcars_data$mpg,mtcars_data$disp,xlab="MPG",ylab="DISP")
Error
There were 34 warnings (use warnings() to see them)
Rplot

System Information:

  • RStudio Edition: (Desktop or Server)
  • RStudio Version: 1.2.33
  • OS Version: Mac OS Mojave
  • R Version: 3.6.0
  • sessionInfo():

Referred here from support.rstudio.com

boxplot does not take x and y arguments in the way you have tried. It is easiest to use formula notation as in the example below. Also, the displ variable has many levels, almost as many as there are rows of data, so that will not make a useful box plot. I used cyl instead.

mtcars_data <- mtcars
boxplot(mpg ~ cyl, data = mtcars_data, xlab = "cylinders", ylab = "miles per gallon")

Created on 2019-06-30 by the reprex package (v0.2.1)

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.