Title: Using jupyter R kernel with visual studio code
Tags: r;visual-studio-code;jupyter
Question: For python jupyter notebooks I am currently using VSCode python extension. However I cannot find any way to use alternative kernels. I am interested in jupyter R kernel in particular. 

Is there any way to work with jupyter notebooks using R kernel in VSCode?

Comment: Folks at Microsoft are on it. https://github.com/Microsoft/vscode-python/issues/5078#issuecomment-608175269

Comment: Is there any update to this?


Here is another answer: Agreed with @essicolo, if you are 100% stuck on using vscode this is a no-go.
```
[About kernels] Sorry, but as of right now this feature is only supported with Python. We are looking at supporting other languages in the future.
Yeah, that's the case for now, even if you start an external server. I hate having to say that, as we really want to support more of the various language kernels. But we started out with a Python focus and we still are pretty locked into that for the near future. Polyglot support is coming, but it won't be right away
```
per Microsoft Employee IanMatthewHuff
https://github.com/microsoft/vscode-python/issues/5109#issuecomment-480097310

preface - based on the phrasing of your question, I am making the assumption that you are trying to perform ```IRkernel``` in-line execution from your text ide without having to use a jupyter notebook / jupyterlab.
That said, if you're willing to go to the dark side, there might be some alternatives:

nteract's Hydrogen kernel for Atom IDE - the only text ide that I'm aware of that still supports execution against ```IRkernel```. I know, I know - it's not ```vscode``` but it's as close as you'll probably get for now.



TwoSigma's Beaker notebook - it's been a lonngggg time for me but this a branch of jupyter that used to support polyglot editing, I'm not sure if that's still supported and it seems like you aren't that interested in notebooks anyway.



Here is another answer: Yes, it is possible. It just requires an additional configuration to connect with the R kernel in VSCode.
It's worth noting that, if you prefer, you can use the notebook in VSCode Insiders where there is native support for notebooks in many languages, including R.

If you're using Jupyter in VSCode, firstly install IRkernel (R kernel).
According to the docs, run both lines to perform the installation:
```install.packages('IRkernel')
IRkernel181a:6c1c:918f:f3a4:2e8c:61d6:1a08:6b16installspec()  # to register the kernel in the current R installation
```
Now, you should:

Reload Window Ctrl + R

Type Ctrl + Shift + P to search for &quot;Jupyter: Create New Blank Notebook&quot;


Click on the button right below ellipsis in upper right corner to choose kernel


Switch to the desired kernel, in this case, R's 


That's it!

Comment for this answer: could you provide some info or link why is buggy about vs code and the integration with R kernel ? Maybe just not the case anymore ? Looks to me it works pretty well
Comment for this answer: Just in case that someone has the same trouble as me following the instructions without getting it to work: it might be necessary to call `IRkernel181a:6c1c:918f:f3a4:2e8c:61d6:1a08:6b16installspec(user = FALSE)` , for me it did not show up in the list of kernels before.
Comment for this answer: Does this still work?
Comment for this answer: The integration had some bugs by the time I wrote (I couldn't even plot a table correctly). Nevertheless, nowadays they seem to have **fixed** most [issues](https://github.com/microsoft/vscode-jupyter/issues?q=is%3Aissue+is%3Aopen+R+label%3Alanguage-R).

Here is another answer: @testing_22 it works with me too
just add some note from my experience
It will failed If you run ```IRkernel181a:6c1c:918f:f3a4:2e8c:61d6:1a08:6b16installspec()``` from RStudio or from Jupyter Conda environment failed way
Please run this syntax with VSCode terminal
```install.packages('IRkernel')
IRkernel181a:6c1c:918f:f3a4:2e8c:61d6:1a08:6b16installspec()
```

The rest is same, please restart VSCode and select &quot;R&quot; kernel from VSCode


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 3, 'CommentCount': 2, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2019:00:06/07/19', 'FavoriteCount': 0.0, 'PostTypeId': 1, 'Tags': '<r><visual-studio-code><jupyter>', 'Title': 'Using jupyter R kernel with visual studio code', 'ViewCount': 9469, 'id': 56497422, 'user_AboutMe': "<p>PhD Student at the School of Engineering, and Centre for Scientific Computing, University of Warwick, Coventry, UK.</p>\n\n<p>I'm mainly interested in Biophysics and simulations of Biochemical systems using Molecular Dynamics and Monte Carlo combined with free energy methods, and HPC.</p>\n\n<p>Languages I'm confident with:\nFortran\nTcl,\nBash,\nR,\nLaTeX</p>\n\n<p>Operating system I on my machines: Debian OS and Ubuntu. </p>\n", 'user_AccountId': 1264258.0, 'user_DisplayName': 'Salvatore Cosseddu', 'user_Reputation': 372.0, 'user_Views': 23.0, 'user_id': 1221916.0}}