Reputation: 1
I have a Python script that will pass dataframes into an R package and get the results. The R script works as expected in R studio.
However I cannot get it to wokr when executing through python/rpy2.
rpy2.rinterface_lib.embedded.RRuntimeError: Error in ataframe d%>% dplyr::rename(domain = Domain, variable = Variable, :
could not find function "%>%"
Is there a way to get this to work when executing through python? Rewriting the code to not use %>% is working but will require a lot of rewriting that I would prefer to avoid if possible.
I've tried making sure the dplyr library is in every script. I've confirmed its installed prior to running the python script.
I have not found any examples of this issue while using rpy2/python.
Upvotes: 0
Views: 192
Reputation: 145765
%>%
is from the magrittr
package. If you have R version 4.1 or later you can use the native |>
pipe instead.
Upvotes: 2