Exercise

Collapsing data frames

In the last exercise you already combined glue() and glue_collapse() to create a correct English sentence from a vector. But very often, you will work not with vectors but with data frames. Luckily the workflow for data frame columns is the same as it is for vectors.

In the scope you have again our data frame users with three names and numbers of logins in it. Use glue_collapse() and print the columns of the data frame in a human readable form.

Instructions

100 XP
  • Print the column names of users by printing each column name separated by ", " in glue_collapse().
  • Use glue() and glue_collapse() to list the names of users stored in the name column in a human-readable way, while ensuring the last name is preceded by " and ".
  • Repeat the same steps, this time for the number of logins stored in the logins column.