Mod 12-II-A Quiz #2

pdf

School

University of Alberta *

*We aren’t endorsed by this school

Course

200

Subject

Computer Science

Date

Dec 6, 2023

Type

pdf

Pages

4

Uploaded by ChancellorNarwhalPerson1021

Report
Mod 12-II-A Quiz #2-ACR gp Batch 2023 1 Mod 12-II-A Quiz #2: 1: How can the following code be changed to reflect a histogram, with a title of "History of the Price of Diamonds", labeling the x-axis "Price of Diamonds" and the -axis "Frequency"? hist(diamonds$price) a) hist(diamonds$price, main = "History of the Price of Diamonds" ylab = "Frequency" xlab = "Price of Diamonds") b) hist(diamonds$price, title ="History of the Price of Diamonds" X-axis ="Frequency" y-axis = "Price of Diamonds") c) hist(diamonds$price, name = "History of the Price of Diamonds" y-axis = "Frequency" x-axis = "Price of Diamonds") d) hist(diamonds$price, main = "History of the Price of Diamonds", xlabel = "Frequency' ylabel = "Price of Diamonds", ) 2: You want to arrange bars in a chart from greatest to least in value. Which command would replace the BLANK in the code below to achieve this? diamonds %>% select (clarity) %>% table() %>% BLANK Barplot() a) sort (increasing = T) %>% b) sort (greatest - least) %>% c) sort (greatest = T) %>% d) sort (decreasing = T) %>%
Mod 12-II-A Quiz #2-ACR gp Batch 2023 2 3: Which two procedures are needed to calculate the distance and hierarchy of the clusters in your cluster chart created with the code below? hc %>% plot (labels = df$state _ code) a) grp and dist b) dist and hclust c) Library and clustplot d) kmeans and plot 4: You make a barplot with the following code. Using color names, how can you color the barplot red? X = c (24, 13, 7, 5, 3, 2) barplot(x) a) barplot(x, col = rgb(.80, 0, 0, max = 255) ) b) barplot (x, col = "red3") c) barplot (col, xl = "red") d) barplot (x, col = rgb(. 80, 0, 0)) 5: Using the pipes process from tidyverse, which code correctly shows a boxplot that compares price and color? a) diamonds %>% select (color, price) %>% plot() b) diamonds %>% select (price, color) %>% plot ( ) %>% c) diamonds %>% select(color) %>% select (price) %>> plot () d) diamonds %>% select (price) %>% select(color) %>% boxplot () g>%
Mod 12-II-A Quiz #2-ACR gp Batch 2023 3 6: If you want to include quotes in your labels when creating a scatterplot, which character must you include? a) the ampersand or at (@) character b) the star or asterisk (*) character c) the caret or control (^) character d) the escape or backslash (\) character 7: Which function adds new variables and preserves existing ones? a) Switch() b) Transmute () c) Mutate () d) Rescale () 8: How can you filter by multiple variables using piping to return data where "regions" are equal to "South" or "psychRegions" are equal to "Relaxed and Creative"? a) df %>% filter(region = "South" | psychRegions= "Relaxed and Creative") %> print () b) df%>% filter(region == "South' & psychRegions== "Relaxed and Creative") %>% print () c) df %>% filter(region == "South" & !psychRegion s== "Relaxed and Creative") 9>% Print () d) df %>% filter (region == "South" | psychRegions == "Relaxed and Creative") %>% print()
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Mod 12-II-A Quiz #2-ACR gp Batch 2023 4 9: Using the table command, how can you create a contingency table specifying two variables in R? a. cor.test(df$variable, df$variable) ct b. fit1 <- lm(df$variable, df$variable) ct c. tchi <- chisq. test(df$variable, df$variable) ct d. ct<- table(df$variable, df$variable) ct 10: Choosing two variables from a data frame, how can you look at the correlation of those variables? a) rrcor(dfvariable, dfvariable) b) cor (df (variable, variable) ) c) cor. test (df$variable, df$variable) d) cor.df ($variable, $variable)