Open samgilbert1983 opened 7 years ago
Sorry, but nobody actively develops the package nowadays. If you want this to be fixed I'm afraid you'll have to debug it yourself. There's probably something that tibble
does differently from data frames, despite pretending to be a data frame.
For what it's worth, the cause of the error is:
dim(df) # [1] 21 1
as.matrix(format(df)) # [1] 14 1
HTML.data.frame - reasonably, IMO - assumes that both are equal, but tibble:::format.tbl_df() shortens it beyond 20 rows (and formats it is a way that does not immediately make any sense to me).
HTML(data.frame(df)) works.
Explicitly coercing x <- data.frame(x)
inside HTML.data.frame() would do the trick in this case, but I'm not entirely sure, whether there could be unintended side-effects for other data.frame derived classes.
Thanks for the diagnosis!
One way of solving this which sounds relatively safe would be to define a separate method for tibbles:
HTML.tbl_df <- function(x, ...) HTML(data.frame(x), ...)
I'm getting a subscript out of bounds error when I try to insert a data frame tbl with more than 20 rows into an html document.
The above example errors with:
Error in x.formatted[i, ] : subscript out of bounds
Removing the
tbl_df()
works as expected.Session info: