Session Ready
Exercise

Convert values with possibly()

Let's say you need to convert the Star Wars character heights in sw_people from centimeters to feet. You already know that some of the heights have missing data, so you will use possibly() to convert missing values into NA. Then you will multiply each of the existing values by 0.0328084 to convert them from centimeters into feet.

To get a feel for your data, print out height_cm in the console to check out the heights in centimeters.

Instructions
100 XP
  • Pipe the height_cm object into a map_*() function that returns double vectors.
  • Convert each element in height_cm into feet (multiply it by 0.0328084).
  • Since not all elements are numeric, use possibly() to replace instances that do not work with NA_real_.