Quiz 1

Classwork 5

Author

Byeong-Hak Choe

Published

October 4, 2024

Modified

October 7, 2024

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_filtered <- df |> filter(num __ 9)
  • Fill in the blank (___) to keep observations, in which the value of the num variable is greater than or equal to 9.

Answer: >=

df_filtered <- df |> filter(num >= 9)



Question 4. ! (Negation operator)

non_dec <-  df |> filter( ___(month == 12) )
  • Fill in the blank (___) to keep observations, in which the value of the month variable is not equal to 12 in the data.frame df.

Answer: !

non_dec <-  df |> filter( !(month == 12) )
non_dec <-  df |> filter( month != 12 )



Question 5. & (And operator)

df_filtered <- df |> filter(subject == "DANL" ___ number == 101)
  • Fill in the blank (___) to keep observations, in which the value of the subject variable is “DANL” and the value of the number variable is 101.

Answer: & (,)

df_filtered <- df |> filter(subject == "DANL" & number == 101)
df_filtered <- df |> filter(subject == "DANL", number == 101)



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!

Back to top