Quiz 1 - Addendum

Classwork 7

Author

Byeong-Hak Choe

Published

October 7, 2024

Modified

October 7, 2024

Descriptive Statistics

The following provides the percentage of the correct answers for each question in Quiz 1 - Addendum:



Question 1. data.frame

In a data frame, what form does a variable take?

Answer: Column

  • 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 column
    • An observation takes a row
    • A value takes a cell



Question 2. left_join()

df_joined <- df_1 |> ___(df_2)
  • Fill in the blank (___) to join the two related data.frames, df_1 and df_2, in a way that keeps all observations and variables in the data.frame df_1.

Answer: left_join

df_joined <- df_1 |> left_join(df_2)



Question 3. == (Equality operator)

df_filtered <- df |> filter(num __ 9) 
  • Fill in the blank (___) to keep observations, in which the value of the num variable is equal to 9.

Answer: ==

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



Question 4. != (Not-equal operator)

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

Answer: !=

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



Question 5. | (Or operator)

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

Answer: |

df_filtered <- df |> filter(subject == "DANL" | subject == "ECON")
  • This slide and this slide in Lecture 14 explain logical operation, | (or).

  • Please note that | is not the letter “I” or “l,” but a vertical bar character.

  • On a keyboard, | is located above the Enter/Return key.



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