Fix for R[write to console]: No package called tidyverse
in notebook¶
It can be convenient to add R to Jupyter or VS Code Notebook. However, if you've installed R packages using RStudio, you might get an error when you try to use them in a Jupyter Notebook.
The problem¶
For example, you try to include the tidyverse
package in your notebook:
And you receive the following error:
This might be happening because you have multiple versions of R installed on your computer, and the version of R that Jupyter or VS Code Notebook is using is different from the version of R that you used to install the tidyverse
package.
The fix¶
You probably want the R that's in RStudio to be the same one that Jupyer uses. To do this we need to overwrite the kernel that Jupyter uses.
The kernel is the connection between Jupyer and R. It's the thing that tells Jupyter how to run R code.
Run the code below in RStudio. It will take the R kernel that's in RStudio and overwrite the kernel that Jupyter uses:
Problem solved!
Someday you might want to remove the old kernel that Jupyter was using, but you'll be fine for now...