Follow these steps to get started:
- Let's start by doing some imports:
import osfrom IPython.display import Imageimport rpy2.robjects as robjectsimport pandas as pdfrom rpy2.robjects import pandas2rifrom rpy2.robjects import default_converterfrom rpy2.robjects.conversion import localconverter
We will be using pandas on the Python side. R DataFrames map very well to pandas.
- We will read the data from our file using R's read.delim function:
read_delim = robjects.r('read.delim')seq_data = read_delim('sequence.index', header=True, stringsAsFactors=False)#In R:# seq.data <- read.delim('sequence.index', header=TRUE, stringsAsFactors=FALSE)
The first thing that we do after importing is access the read.delim R function, which allows ...