Skip to contents

Automatically create tibbletime objects from tibbles

Usage

prep_tbl_time(data, message = FALSE)

Arguments

data

A tibble.

message

A boolean. If TRUE, returns a message indicating any conversion details important to know during the conversion to tbl_time class.

Value

Returns a tibbletime object of class tbl_time.

Details

Detects a date or datetime index column and automatically

Examples


library(dplyr)
library(tibbletime)
#> 
#> Attaching package: ‘tibbletime’
#> The following object is masked from ‘package:stats’:
#> 
#>     filter

data_tbl <- tibble(
    date  = seq.Date(from = as.Date("2018-01-01"), by = "day", length.out = 10),
    value = rnorm(10)
    )

prep_tbl_time(data_tbl)
#> # A time tibble: 10 × 2
#> # Index:         date
#>    date        value
#>    <date>      <dbl>
#>  1 2018-01-01  1.16 
#>  2 2018-01-02  0.283
#>  3 2018-01-03 -0.198
#>  4 2018-01-04  0.680
#>  5 2018-01-05 -0.547
#>  6 2018-01-06  0.337
#>  7 2018-01-07  0.656
#>  8 2018-01-08 -1.80 
#>  9 2018-01-09 -0.153
#> 10 2018-01-10  1.66