Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR support for multi line execution #455

Open
olivroy opened this issue Jun 28, 2024 · 2 comments
Open

FR support for multi line execution #455

olivroy opened this issue Jun 28, 2024 · 2 comments
Labels
feature New feature or request

Comments

@olivroy
Copy link

olivroy commented Jun 28, 2024

Currently, this just errors
image

@georgestagg
Copy link
Member

Thanks for making this request! I'm just going to expand with some thoughts below.


Running the following multiline code with the webR editor works OK. In other words, it works when the full script is valid R code:

dplyr::tibble(
  mtcars
)

The following code indeed does error, but this is to be expected in the current implementation since the script is source()-ed by the webR app when the run button has been pressed.

dplyr::tibble(

Partial execution (leaving the R console with a continue prompt, similar to directly executing the code into the console):

> dplyr::tibble(
+ 

is a little difficult right now. We explicitly source() the script because for longer R scripts it's possible to run out of space in the R input buffer. Perhaps we should send to console when the length is shorter than the input buffer, and only source() R scripts longer than that, but this would create different behaviours depending on the length of your script - not ideal.

Alternatively, we could chunk longer R scripts into blocks that fit into R's input buffer, then execute the chunks sequentially. This is probably the best option in the long run.

@georgestagg georgestagg added the feature New feature or request label Jul 8, 2024
@olivroy
Copy link
Author

olivroy commented Jul 8, 2024

Oh, I should have been maybe more specific. The full code included a pipe. Thanks for considering!

dplyr::tibble(
  x = c(1, 2)
 ) |> 
  dplyr::mutate(
     y = x ** 2
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants