You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I create two identical() tibbles but they behave differently. This is freaking me out.
This is really hard to debug because rbind() doesn't call tibble explicitly, it's a non generic base function that calls Internal(rbind()) and in there rownames<- is called and since it's generic we get into the tibble package.
library(tibble)
tb1 <- tibble(
e = structure(list(list(4), list(5)), class = c("tbl_df", "tbl", "data.frame"), row.names = 1L, names = c("f", "g"))
)
tb2 <- tibble(e = tibble::tibble(f = list(4), g = list(5)))
identical(tb1, tb2, attrib.as.set = FALSE)
#> [1] TRUE
attributes(tb1$e)
#> $class
#> [1] "tbl_df" "tbl" "data.frame"
#>
#> $row.names
#> [1] 1
#>
#> $names
#> [1] "f" "g"
attr(rbind(tb1)$e, "row.names")
#> Warning: Setting row names on a tibble is deprecated.
#> [1] "1"
attr(rbind(tb2)$e, "row.names")
#> [1] 1
options(warn=2)
rbind(tb1)
#> Error: (converted from warning) Setting row names on a tibble is deprecated.
traceback()
#> 10: doWithOneRestart(return(expr), restart)
#> 9: withOneRestart(expr, restarts[[1L]])
#> 8: withRestarts({
#> .Internal(.signalCondition(cond, message, call))
#> .Internal(.dfltWarn(message, call))
#> }, muffleWarning = function() NULL)
#> 7: warning(cnd)
#> 6: warn("Setting row names on a tibble is deprecated.")
#> 5: `row.names<-.tbl_df`(`*tmp*`, value = value)
#> 4: `row.names<-`(`*tmp*`, value = value)
#> 3: `rownames<-`(`*tmp*`, value = `*vtmp*`)
#> 2: rbind(deparse.level, ...)
#> 1: rbind(tb1)
Do we set some global handlers that for some reason get triggered in one case and not the other ?
If we debug rownames<- we can hop into Internal(rbind()) and we see that :
in rbind(tb1) it is called twice, with a value of "1" and then with a NULLvalue.
in rbind(tb2) it is called once with a NULLvalue.
debug(`rownames<-`)
rbind(tb1)
rbind(tb2)
The text was updated successfully, but these errors were encountered:
I create two
identical()
tibbles but they behave differently. This is freaking me out.This is really hard to debug because
rbind()
doesn't call tibble explicitly, it's a non generic base function that callsInternal(rbind())
and in thererownames<-
is called and since it's generic we get into the tibble package.Do we set some global handlers that for some reason get triggered in one case and not the other ?
If we debug
rownames<-
we can hop into Internal(rbind()) and we see that :value
of"1"
and then with aNULL
value
.NULL
value
.The text was updated successfully, but these errors were encountered: