December 2018
Beginner to intermediate
682 pages
18h 1m
English
The wide_to_long function works in a fairly specific manner. Its main parameter is stubnames, which is a list of strings. Each string represents a single column grouping. All columns that begin with this string will be stacked into a single column. In this recipe, there are two groups of columns: actor, and actor_facebook_likes. By default, each of these groups of columns will need to end in a digit. This digit will subsequently be used to label the reshaped data. Each of these column groups has an underscore character separating the stubname from the ending digit. To account for this, you must use the sep parameter.
The original column names do not match the pattern needed for wide_to_long to work. The column names could ...