library(tidyverse)
#> + ggplot2 2.2.1.9000 Date: 2017-05-20
#> + tibble 1.3.1 R: 3.4.0
#> + tidyr 0.6.3 OS: elementary OS 0.4.1 Loki
#> + readr 1.1.1 GUI: X11
#> + purrr 0.2.2.2 Locale: en_US.UTF-8
#> + dplyr 0.5.0.9005 TZ: posixrules
#> + stringr 1.2.0
#> + forcats 0.2.0
#> Conflicts -----------------------------------------------------------------
#> * filter(), from dplyr, masks stats::filter()
#> * lag(), from dplyr, masks stats::lag()
library(hms)
data_frame(minutes = 1:3, hours = 1:3) %>%
mutate(times = hms(0, minutes, hours))
#> Error in mutate_impl(.data, dots): All arguments to hms() must have the same length or be NULL. Found length(seconds) = 1, length(minutes) = 3, length(hours) = 3.
## When `Vectorize`d, vector of length 1 is recycled
hms <- Vectorize(hms)
data_frame(minutes = 1:3, hours = 1:3) %>%
mutate(times = hms(0, minutes, hours))
#> # A tibble: 3 x 3
#> minutes hours times
#> <int> <int> <dbl>
#> 1 1 1 3660
#> 2 2 2 7320
#> 3 3 3 10980
Last active
May 21, 2017 02:57
-
-
Save yeedle/38c0722841ea05f2c587f7d9ce0f0d9b to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment