Today i will teach you How to Add R to Jupyter Notebook
You can add R to Jupyter Notebook by typing this command in the Anaconda Prompt:
conda install -c r r-irkernel
But just in case you were wondering, here are the full steps to add R to Jupyter Notebook from scratch.
Steps to Add R to Jupyter Notebook
Step 1: Open the Anaconda Prompt
To start, open the Anaconda Prompt:
You’ll then see the following screen with your user name:
Step 2: Add R to Jupyter
Next, type/copy the following command in order to add R to Jupyter:
conda install -c r r-irkernel
The command would look like this in the Anaconda Prompt (press ENTER to proceed with the installation):
You’ll eventually see the following:
Type ‘y‘ and then press ENTER to proceed:
After a short period of time your installation will be completed:
Step 3: Launch Jupyter Notebook
To launch Jupyter Notebook, first open the Anaconda Navigator:
Then, click on the button to launch Jupyter:
Next, click on ‘New’ on the top right-hand-side of your screen:
Finally, select ‘R’ from the drop-down list:
You’ll then see the following screen where you can type your code:
Step 4: Run your Code
You can now run your desired R code.
For example, you can create a simple DataFrame in R using this syntax:
df <- data.frame(name = c('Jon', 'Bill', 'Maria'),
age = c(23, 41, 32)
)
print (df)
This is how the syntax would look in Jupyter Notebook:
Click on ‘Run’ and you’ll then get the following DataFrame: