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

Feature Request: Implement Output Insertion as Comments for Evaluated R Code #1457

Open
ipstone opened this issue Nov 29, 2023 · 4 comments
Open

Comments

@ipstone
Copy link

ipstone commented Nov 29, 2023

Title: Feature Request: Implement Output Insertion as Comments for Evaluated R Code

Description:

I propose adding a feature to vscode-R that allows users to evaluate selected R code and automatically insert the output as comments in the editor. This feature, inspired by a similar functionality in Nvim-R, would enhance the data analysis workflow by allowing immediate inspection and documentation of code outputs within the editor.

Reference:

Key Points:

  • Select and evaluate R code in the editor.
  • Capture the output and insert it as a comment directly below the evaluated code.
  • Useful for iterative exploration and documentation in data analysis.

Implementation Suggestion:

  • Extend existing 'send code to terminal' functionality.
  • Add a method to capture terminal output and format it as a comment in the editor.

Impact:
This feature would streamline the R coding process in VS Code, making it more efficient for data analysis and similar tasks.

@benz0li
Copy link
Contributor

benz0li commented Nov 30, 2023

IMHO That is what R Notebooks were (are?) meant for.
ℹ️ Unfortunately, VSCode Notebook API support was never implemented because the R kernel depends on zmq.

@benz0li
Copy link
Contributor

benz0li commented Nov 30, 2023

There is the Jupyter extension. Jupyter Notebooks paste output below the R code cells.

The Quarto extensions shows output side by side in a Jupyter interactive console.

@eitsupi
Copy link
Contributor

eitsupi commented Nov 30, 2023

ℹ️ Unfortunately, VSCode Notebook API support was never implemented because the R kernel depends on zmq.

This is off-topic, but there are other kernels for R besides IRkernel.
https://github.com/melff/RKernel
https://github.com/jupyter-xeus/xeus-r

@ipstone
Copy link
Author

ipstone commented Nov 30, 2023

thanks @benz0li @eitsupi

The point of running the code and getting output into the Rscript, is really Rscript/text based/focused data analysis cycle, it's a lot of faster than jupyter, and oftenly are done in an terminal environment. I have been using juyter and Rmarkdown, but it's more for situations where we need to present the data; for explorative data analysis, a plain Rscript is usually leaner and getting the job done faster.

ideas/suggestions on sending codes to R and wrap the output back into the editor (or even getting the output to the clipboard is helpful)

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

No branches or pull requests

3 participants