Recall & Review
beginner
What does the
separate() function do in R's tidyr package?It splits one column into multiple columns based on a separator, like splitting a full name into first and last names.
Click to reveal answer
beginner
What is the purpose of the
unite() function in R?It combines multiple columns into one column by joining their values with a separator, like merging first and last names into a full name.
Click to reveal answer
intermediate
Which argument in
separate() controls the character used to split the column?The
sep argument specifies the separator character or regular expression to split the column.Click to reveal answer
intermediate
How do you prevent
separate() from dropping the original column after splitting?Use the argument
remove = FALSE to keep the original column in the data frame.Click to reveal answer
intermediate
What happens if you use
unite() with remove = FALSE?The original columns are kept along with the new united column, so no data is lost.
Click to reveal answer
What does
separate() do in R's tidyr package?✗ Incorrect
separate() splits a single column into multiple columns based on a separator.
Which argument in
unite() sets the character between combined values?✗ Incorrect
The sep argument defines the separator between combined values in unite().
If you want to keep the original columns after using
unite(), which argument should you use?✗ Incorrect
Setting remove = FALSE keeps the original columns after uniting.
What type of value does the
sep argument accept in separate()?✗ Incorrect
sep accepts a character string or regular expression to split the column.
Which package provides the
separate() and unite() functions?✗ Incorrect
separate() and unite() are part of the tidyr package.
Explain how you would split a column of full names into first and last names using R.
Think about the separator between first and last names.
You got /4 concepts.
Describe how to combine two columns, like city and state, into one column in R.
Consider how to join values with a character.
You got /4 concepts.