我正在尝试通过rpy2从 python中对R
包 ( ) 进行简单调用。这就是我想要实现的目标:ks
import rpy2.robjects as robjects
# Define two matrices.
matrix1 = [[1,1,1,1], [3,3,3,3]]
matrix2 = [[1,1,1,1], [3,3,3,3]]
# Call 'ks' function to obtain p_value.
p_val = robjects.r('''
library(ks)
kde.test(x1=matrix1, x2=matrix2)$pvalue''')
print p_val
我尝试遵循rpy2 的文档,但它非常稀缺。任何帮助,将不胜感激。