Pivotwider
Pivot_wider is a data reshaping function in the tidyr package of the tidyverse. It converts data from a long (tall) format to a wide format by turning unique values from one column into separate columns and filling those cells with corresponding values from another column. It is commonly used to prepare data for tabular presentation or analysis that benefits from wide equations or comparisons.
The essential inputs are data, id_cols, names_from, and values_from. id_cols identifies the columns that define each
Pivot_wider is the counterpart to pivot_longer, which converts wide to long. It also supersedes the older spread
Pivot_wider(data, id_cols = id, names_from = category, values_from = amount) widens a dataset so that each category becomes a