This recipe is an aggressive simplification of the previous one because it illustrates the conciseness and elegance of R magics:
- The first thing you need to do is load R magics and ggplot2:
import rpy2.robjects as robjectsimport rpy2.robjects.lib.ggplot2 as ggplot2%load_ext rpy2.ipython
Note that the % starts an IPython-specific directive. Just as a simple example, you can write %R print(c(1, 2)) on a Jupyter cell.
Check out how easy it is to execute the R code without using the robjects package. Actually, rpy2 is being used to look under the hood.
- Let's read the sequence.index file that was downloaded in the previous recipe:
%%R seq.data <- read.delim('sequence.index', header=TRUE, stringsAsFactors=FALSE) seq.data$READ_COUNT ...