Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to add R code to your (IPython) Jupyter Notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@simecek

This comment has been minimized.

Owner

simecek commented Mar 23, 2017

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/

@drwecki

This comment has been minimized.

drwecki commented Apr 23, 2018

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") %>%

@raymondben

This comment has been minimized.

raymondben commented May 24, 2018

@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