Last active
January 16, 2021 13:29
-
-
Save simecek/019d87c55fec3839d95bbf8489dde61d to your computer and use it in GitHub Desktop.
How to add R code to your (IPython) Jupyter Notebook
Can you explain what this piece of code is doing? (also is this part of R magic or is it just part of R). Thanks, I'm just wrapping my head around R magics.
df %>%
gather("Category", "X") %>%
@drwecki, the pipe operator %>%
just pushes the first thing into the second, so this code is equivalent to:
gather(df, "Category", "X")
And the gather
function takes data from multiple columns and collapses them into key-value pairs
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The installation of R and R magic into Jupyter notebook is described here:
https://www.datacamp.com/community/blog/jupyter-notebook-r#gs.z0gxLNc
Or you can run it all in the docker and do not care about installation
https://github.com/jupyter/docker-stacks/tree/master/datascience-notebook
And even better, you can run it all in the cloud and do not care about anything, except your credit card bill (~$0.05 / hour you actually use it)
https://simecek.github.io/blog/2017/02/17/data-science-amazon-vm-with-start/stop-functionality/