RStudio fails to execute a function with a newline before the arguments and a pipe

When calling a function with a newline before the first argument, if this call is followed by a pipe, RStudio fails to recognize it as a single block of code to execute with ctrl+Enter.

An example will help:

paste0(
 "x") %>%
 print()

If I position the cursor on the first line and hit ctrl+Enter, the code executes as expected. If I position the cursor on the last line and hit ctrl+Enter, the first line is not executed and this results in an error.

This is not a major problem, but it is hard to pinpoint the source when happening in a bigger block of code.

Observed with RStudio 1.3.959, R 4.0.0, magrittr 1.5 on Windows 10.

Was already reported as issue #2667. I had missed it previously.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.