0

I am trying to use as_tbl_time but I am receiving the error in the title.

library(tidyverse)
library(lubridate)

dates <- c("01/01/18 1:01:10 PM" ,"01/01/18 1:10:10 PM")
vals <- c(100, 200)

df <- data.frame(dates, vals)

df$dates <- dmy_hms(df$dates)

df <- as_tbl_time(df, index = df$dates)
George
  • 5,808
  • 15
  • 83
  • 160

1 Answers1

0

From the documentation:

index The bare column name of the column to be used as the index.

So you just need the column name: tibbletime::as_tbl_time(df, index = dates)

Not df$.

RLave
  • 8,144
  • 3
  • 21
  • 37