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
view() has some sort of negative interaction with the new native pipe when the incoming expression is somewhat complicated and the title isn't explicitly specified. In the error case, the message is Error in View : invalid caption argument.
Poking around in the debugger, it seems like the problem is with expr_deparse() and the fact that the native pipe (unlike the magrittr pipe) is just syntactic sugar for nesting function calls. When the expression being piped into view() is long, expr_deparse() breaks it into multiple lines (I guess because it's intended for printing?), but then View() doesn't know what to do with a multi-line title. Using capital-V View(), the default title appears to be the whole incoming expression.
library(tibble)
library(dplyr)
## Works correctly
starwars |>
view()
## Also works correctly
starwars |>
mutate(height_m = height/100) |>
view()
## Error in View : invalid caption argument
starwars |>
mutate(height_m = height/100) |>
mutate(mass_g = mass * 1000) |>
view()
## Error in View : invalid caption argument
starwars |>
mutate(height_m = height/100,
mass_g = mass * 1000) |>
view()
## Works correctly if the caption is explicit
starwars |>
mutate(height_m = height/100,
mass_g = mass*1000) |>
view('converted')
Hmm, I’m also on RStudio 1.4.1717. IIRC changing the width of the RStudio Console pane silently changes some width-related options. Perhaps expr_deparse() is using these options to figure out where to break expressions to separate lines? If so, then maybe making the Console pane more narrow will replicate the issue?
krlmlr
added
bug
an unexpected problem or unintended behavior
and removed
reprex
needs a minimal reproducible example
labels
Oct 25, 2021
tibble 3.1.6
- `set_num_opts()` and `set_char_opts()` are reexported from pillar (#959).
- `view()` uses `rlang::expr_deparse(width = Inf)` to avoid errors with long `|>` pipes (#957).
- `new_tibble()` checks that the `nrow` argument is nonnegative and less than 2^31 (#916).
- `tbl_sum.tbl_df()` has an ellipsis in its formals for extensibility.
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.
view()
has some sort of negative interaction with the new native pipe when the incoming expression is somewhat complicated and the title isn't explicitly specified. In the error case, the message isError in View : invalid caption argument
.Poking around in the debugger, it seems like the problem is with
expr_deparse()
and the fact that the native pipe (unlike the magrittr pipe) is just syntactic sugar for nesting function calls. When the expression being piped intoview()
is long,expr_deparse()
breaks it into multiple lines (I guess because it's intended for printing?), but thenView()
doesn't know what to do with a multi-line title. Using capital-VView()
, the default title appears to be the whole incoming expression.The text was updated successfully, but these errors were encountered: