Closed muschellij2 closed 6 years ago
Trying to use a tibble versus a data.frame causes errors:
tibble
data.frame
library(timevis) # daattali/timevis library(tibble) data <- tibble::data_frame( id = 1:4, content = c("Item one" , "Item two" ,"Ranged item", "Item four"), start = c("2016-01-10", "2016-01-11", "2016-01-20", "2016-02-14 15:00:00"), end = c(NA , NA, "2016-02-04", NA) ) timevis(data) #> Error: Can't use matrix or array for column indexing
Created on 2018-04-02 by the reprex package (v0.2.0).
I think just adding a is.tibble then as.data.frame may help on line: https://github.com/daattali/timevis/blob/defb22873953d8b7f41c4212759d665732b4a5ff/R/utils.R#L20 which occurs because this returns TRUE because of tibble inheritance
is.tibble
as.data.frame
TRUE
You can also just do a simple:
if (is.data.frame(df)) { df = as.data.frame(df) }
Thanks for the report. Feel free to submit a PR to convert tibbles to dataframes
Trying to use a
tibble
versus adata.frame
causes errors:Created on 2018-04-02 by the reprex package (v0.2.0).
I think just adding a
is.tibble
thenas.data.frame
may help on line: https://github.com/daattali/timevis/blob/defb22873953d8b7f41c4212759d665732b4a5ff/R/utils.R#L20 which occurs because this returnsTRUE
because oftibble
inheritanceYou can also just do a simple: