ICE 10

.pdf

School

University of the Fraser Valley *

*We aren’t endorsed by this school

Course

205

Subject

Computer Science

Date

Dec 6, 2023

Type

pdf

Pages

6

Uploaded by JudgeOxidePorpoise6

Report
11/20/23, 2:23 PM Quiz: In-class Exercise (ICE) 10 https://canvas.ubc.ca/courses/123136/quizzes/656313/take 1/6 In-class Exercise (ICE) 10 Started: Nov 20 at 2:22p.m. Quiz Instructions As long as you're online, your responses to this exercise will be automatically saved as you work through it. You may attempt this exercise as many times as you wish before the deadline, but be aware that only the final attempt's grade will be recorded. Canvas will automatically submit any incomplete attempts when the deadline arrives. Please note, if you've already submitted an attempt and do not plan to make another, avoid starting a new one. Canvas will auto-submit the most recent attempt you initiated, and this will be the attempt that is graded. Assume that you start each question with a fresh R session. Also assume that you loaded all the necessary libraries. For instance, if you happen to use a function from tidyverse , you should assume that it was successfully loaded in that fresh session. 1 pts Question 1 The iris data set is a built-in data set in R. Some information can be found here (https://en.wikipedia.org/wiki/Iris_flower_data_set) . You can type head(iris) on R console to take a look at the first few rows of this data frame. Each observation in the data set reports dimensions of a flower and its species. Questions 1-5 will be based on this data set. You can access to any column of the iris data set by using $ sign (e.g., iris$species allows you to access to the species column of the iris data set) The data set has rows (i.e., observations) and columns (i.e., variables). Note that row index is not a column. Columns have names associated with them. 1 pts Question 2
11/20/23, 2:23 PM Quiz: In-class Exercise (ICE) 10 https://canvas.ubc.ca/courses/123136/quizzes/656313/take 2/6 Answer the following questions by rounding the value obtained to its first decimal place (you can use round() function). Enter the value not the R code: i) The maximum value of Sepal.Length : ii) The minimum value of Sepal.Width : iii) The average value of Petal.Length : iv) The standard deviation of Petal.Width : 1 pts Question 3 You would like to know the species of the flower which has a petal width of 1.7 and a petal length of 5. The code you decided to run is: iris$Species[ (iris$Petal.Width 1.7 iris$Petal.Length==5)] Please fill in each blank with either a function name or a logical operator (i.e., ==, >, <, !, &, |, etc.). 1 pts Question 4
11/20/23, 2:23 PM Quiz: In-class Exercise (ICE) 10 https://canvas.ubc.ca/courses/123136/quizzes/656313/take 3/6 You would like to know the number of flowers (observations) whose petal length is less than or equal to 4.5. Then you can run: (iris$Petal.Length 4.5) Please complete the formula by filling in each blank with a function name or logical operator. 2 pts Question 5 You would like to create a new column that is the ratio of petal length to petal width. Thus, you run: iris$ratio <- iris$Petal.Length iris$Petal.Width After the creation of the ratio variable (i.e., column), you would like to know the average value of ratio values for the versicolor species (note: versicolor is one of the three species of flowers included in this data set). Then you would run: ( [ (iris$Species == " " ) ] ) Please fill in each blank with a function name, appropriate column name (in the form of data frame name, $ sign, and a column name), arithmetic operator, logical operator, or string. 1 pts Question 6
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