Intermediate R
Q79 / 100

What is the purpose of "pivot_longer()" and "pivot_wider()" from the tidyr package?

Correct! Well done.

Incorrect.

The correct answer is B) They reshape data between "long" and "wide" formats, e.g. converting multiple columns into key-value pairs or vice versa

B

Correct Answer

They reshape data between "long" and "wide" formats, e.g. converting multiple columns into key-value pairs or vice versa

Explanation

pivot_longer() gathers columns into rows (wide-to-long), while pivot_wider() spreads rows into columns (long-to-wide), useful for reshaping data for analysis or plotting.

Progress
79/100