Question: Q1: Using the following code as a starting point, create a scatterplot with an x-axis of Hours Waiting and a y-axis of Satisfaction. install.packages(MASS) #Installs
Q1:
Using the following code as a starting point, create a scatterplot with an x-axis of "Hours Waiting" and a y-axis of "Satisfaction."
install.packages("MASS") #Installs the MASS package# library(MASS) #Gets MASS from your library#
set.seed(195) #Sets the seed# mysigma <- matrix(c(1,-0.45,-0.45,1),2,2) #Defines the correlation matrix# mymu <- c(10,100) #Establishes the means of the distribution# mydata <- mvrnorm(50,mu=mymu,Sigma=mysigma,empirical=TRUE) #Creates the data for the scatterplot#
Q2:
Using the following code as a starting point, create a histogram with an x-axis labeled "Colors" and a y-axis labeled "Frequency." Set breaks=8.
set.seed(195) #Sets the seed# blue <- rep(1, each=15, times=1) #Creates blue observations# yellow <- rep(2, each=30, times=1) #Creates yellow observations# white <- rep(3, each=10, times=1) #Creates white observations# black <- rep(4, each= 25, times=1) #Creates black observations# histdata <- c(blue,yellow,white,black) #Combines the colors into a vector#
Q3:
Using the following code as a starting point, create a pie chart. Which slice is the largest?
mydata <- c(15, 32, 28, 25) slices<- c("Damaged", "Average", "Above Average", "Not Generated") percentages <- round(mydata/ sum(mydata) * 100, 1) labels_with_percent <- paste(slices, percentages, "%") mychart <- pie(mydata, labels = labels_with_percent, main = "Product Distribution", col = rainbow(length(mydata)))
Q4:
Submit the R code that would be needed to produce a histogram with the following colors (bars = yellow, border=blue ) and the following percentages respectively: 28, 41, 17, 14. Use breaks = 8.
Q5:
Submit the R code that would be needed to produce a pie chart with the following labels (early, on-time, late, no-show) and the following percentages respectively: 25, 31, 14, 30.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
