我正在尝试在python中使用R函数:
from rpy2.robjects.packages import SignatureTranslatedAnonymousPackage
import rpy2.robjects as ro
string = """
cc <- function(x,y) {
xx <- unlist(x, recursive=FALSE)
yy <- unlist(y, recursive=FALSE)
ccf(xx, yy, plot = TRUE)
}
"""
powerpack = SignatureTranslatedAnonymousPackage(string, "powerpack")
x = list(df1["count"].values)
y = list(df2["count"].values)
x = ro.Vector(x)
y = ro.Vector(y)
print (powerpack.cc(x,y))
代码运行正常。但是功能CCF会显示一个图,我无法看到或检索。
运行代码时,会打开一个新的弹出窗口,但仍然无法获取图。有任何解决方法吗?