The RRuntimeError
exception indicates an error happening when running R, and the message here tells that it cannot open a connection (file)
There is probable a confusion between variable names and content of variables. When writing
knowngenes = r('read.table("known.genes", header=T, as.is=T)')
it is strictly equivalent to writing in R
knowngenes = read.table("known.genes", header=T, as.is=T)
and the code you have before that tells that the name of the file is in a variable called known.genes
.
I'd suggest to rewrite code like this (and minimize the number of objects you are storing in the R global environment):
from rpy2.robjects.packages import importr
utils = importr('utils')
mydataframe = utils.read_table(myfilename, header=True, as_is=True)