Creating objects with rpy2

Asked

Viewed 30 times

1

There are two ways to create R objects using rpy2?

I have an example:

import rpy2.robjects as robjects  

# Criando um objeto R a partir do Python  
robjects.r('''  
rfunc <- function() {  
print("ola")  
}  
''')  

# Imprimindo a definição da função  
r_func = robjects.globalenv['rfunc']  

#imprime a função  
r_func  

Seems to me there’s another way:

pi = robjects.r['pi']  

But from now on I couldn’t make a full example.

There are actually two ways to create R object in python?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.