Relative Content

Tag Archive for rr-markdowndata-manipulation

Error Forming a Boxplot and Scatterplot using 3 Variables in ggplot

I’m trying to work through a problem that I keep encountering in R, where when I try to create a side-by-side boxplot as well as a scatterplot of three variables. I am using the dataset “Boston” located in the ISLR2 package, and I am unsure why the graphs look so weird. For the side-by-side boxplot, I am creating the plot ‘medv’ by two variables, ‘cat_chas’ and ‘cat_rm’, which are both direct mutations of the variables ‘chas’ and ‘rm’ in the Boston dataset. For the scatterplot, I am using the variable ‘age’ on the horizontal axis and ‘medv’ on the vertical axis, with the points being colored by the variable ‘cat_rm’. Is it something simple I am making a mistake on?