Quiz 1
Classwork 5
Descriptive Statistics
The following provides the percentage of the correct answers for each question in Quiz 1:
Question 1. data.frame
In a data frame, what form does an observation take?
Answer: Row
- This slide in Lecture 7 explains what makes a data.frame tidy. In our course, all given data.frames are tidy.
- It’s been a while since we discussed variable-column, observation-row, and value-cell terminologies in a tidy data.frame, but these concepts are crucial for conducting data analysis.
- In a data.frame:
- A variable takes a coulmn
- An observation takes a row
- A value takes a cell
Question 2. nrow()
___(df)
- Fill in the blank (___) to calculate the number of observations in the data.frame,
df
.
Answer: nrow
nrow(df)
This slide in Lecture 8 and a couple of class R scripts explain
nrow()
.You might have difficulty in this question if you do not recall
nrow()
.- Full credit is given to answers that imply counting observations.
Question 3. >=
(Greater-than-or-equal-to operator)
<- df |> filter(num __ 9) df_filtered
- Fill in the blank (___) to keep observations, in which the value of the
num
variable is greater than or equal to 9.
Answer: >=
<- df |> filter(num >= 9) df_filtered
- This slide in Lecture 14 and a couple of class R scripts explain this inequality operator.
Question 4. !
(Negation operator)
<- df |> filter( ___(month == 12) ) non_dec
- Fill in the blank (___) to keep observations, in which the value of the
month
variable is not equal to 12 in the data.framedf
.
Answer: !
<- df |> filter( !(month == 12) ) non_dec
This slide in Lecture 14 and Line 56-57 in this class R script explain a negation operator,
!
(not).A more natural way to write this line is using
!=
(not-equal operator):
<- df |> filter( month != 12 ) non_dec
Question 5. &
(And operator)
<- df |> filter(subject == "DANL" ___ number == 101) df_filtered
- Fill in the blank (___) to keep observations, in which the value of the
subject
variable is “DANL” and the value of thenumber
variable is 101.
Answer: &
(,
)
<- df |> filter(subject == "DANL" & number == 101)
df_filtered <- df |> filter(subject == "DANL", number == 101) df_filtered
- This slide and this slide in Lecture 14 explain logical operation,
&
(and).
Discussion
Welcome to our Quiz 1 Discussion Board! 👋
This space is designed for you to engage with your classmates about the material covered in Quiz 1.
Whether you are looking to delve deeper into the content, share insights, or have questions about the content, this is the perfect place for you.
If you have any specific questions for Byeong-Hak (@bcdanl) or peer classmate (@GitHub-Username) regarding the Quiz 1 materials or need clarification on any points, don’t hesitate to ask here.
Let’s collaborate and learn from each other!