O'Reilly logo

Data Analysis with R - Second Edition by Tony Fischetti

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Computing on columns

Following the procedures in the previous section, let’s convert the thedate column from UNIX time to regular-people time using the anytime package. For this we use the mutate function, as shown in the following code:

> library(anytime)> tracks %<>% mutate(thedate=anytime(thedate))> tracks# A tibble: 138,135 x 5   thedate             trackname                                artist  album         mbid                    <dttm>              <chr>                                    <chr>   <chr>         <chr>                 1 2016-11-25 00:59:07 A Perfect Match                          A*Teens Greatest Hits 69d9cb53-5b8f-41b0-ac~ 2 2016-11-24 17:01:42 Mamma Mia                                A*Teens Greatest Hits 69d9cb53-5b8f-41b0-ac~ 3 2016-11-23 15:30:58 Upside Down                              A*Teens Greatest Hits 69d9cb53-5b8f-41b0-ac~...# ... with 138,125 more rows

Now we can just that count of tracks I listened to in January of 2016, using ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required