Question: 4. GGPlot2 ggplot() ... use ggplot() function on R to do the following : a) Make sure the data type of public.private is factor. Rename
4. GGPlot2 ggplot() ... use ggplot() function on R to do the following :
a) Make sure the data type of public.private is factor. Rename the level name to {public, private} instead of {0; 1} by levels(mdata$public.private) <- c(public, private).
b) Rename the column public.private as School Type by colnames() function.
c) Give a histogram displaying the frequency counts of the public school tuition and private school tuition together. HINT: Call qplot() with 3 arguments. First specify the variable for which you want the frequency count, in this case tuition, then specify the data, and finally, the aesthetic, fill, set equal to School Type.
d) Redo 3(c) by making 2 smaller individual histograms of each subset. List them column-wise in one plot. HINT: With one call to qplot(), work on argument facet.
e) Modify the plot 3(d) as following: title is Tuition Between the Public and Private School; y label is US Dollar; x label is The Number of Schools.
f) Give two boxplots listing column-wise in one plot to explain the relationship between tuition and School Type. HINT: With one call to qplot(), work on argument geom to get boxplot. Unlike the drawing histogram by qplot(), the first three argument of it could be: First specify the variable by which youll split the data. Then specify the variable which you want to examine. The third argument is data source.
g) Redo 3(f) by white background color, font size is 14 and font family equals to Times
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
