-
Notifications
You must be signed in to change notification settings - Fork 103
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
Improve parsing of multi-line R script #6744
Comments
That sounds great. |
I expanded this issue to include the proposal in PR #7610 : RStudio has a good approach. They have an editor and a console. The user can type commands directly into the console (or paste/ctrl-enter commands from the editor). The console executes the lines sequentially. If the statement is incomplete then it changes the console prompt from '>' to '+'. If the user presses 'escape', then it clears the buffer and resets the prompt to '>'. We could consider replacing the script window with a console window, and then using RScript to cover the whole R syntax. R-Instat's console window should then be nearly as good as the one in RStudio (we may omit some of its advanced features). I estimate that this would take around 40 hours including the changes to the RScript library (this is a very rough initial estimate). |
@lloyddewit this is an exciting advance. When you made the recent change (to include brackets in a multiline command) I also checked that this change also worked in the Edit > Script dialogue. I am assuming the new console may make this dialogue obsolete, but I wonder if it may still have a role, because the scripts needed will often have a particular structure, that is made easy through this dialogue, namely: |
@rdstern Initially, we can leave the R-Instat Edit > Script dialog functionality unchanged. If the user clicks the 'To Script' button, then the contents of the editor shall be sent to the new console window. The console shall then process the script just as if it was typed in line by line by the user. In the future, we could enhance the Edit > Script dialog to allow single lines or selected text to be sent to the console. I suggest that we look together at how the RStudio editor and console interact and clarify if/how we should implement this in R-Instat. Do you have any time tomorrow morning (or next week)? Thanks |
@lloyddewit Here is a script - well a function from the DescTools package documentation, function Fibonacci. It gives an error.
When I put it into the script window - development version - the function part. It gives an error and says: |
While I am thinking about it, I list some examples of sample scripts that could be well documented and available, for teaching purposes, and to facilitate tasks that are not so simple directly from the dialogues. These are just to record them and this does not affect the timing/priority of these improvements in R-Instat. |
Note: PR #8551:
|
Great! I am also reminded of this function, which I like, because we use it in the calculator practical. |
PR #6733 processes multiple lines of code in the 'Try' window. This PR works well for most cases. However, more sophisticated R parsing is available in the RScript library. I plan to create a NuGet package from this library in the coming months, and add it to R-Instat. I should then:
The text was updated successfully, but these errors were encountered: