R 矩阵的函数?

R 矩阵的函数?,r,matrix,eval,apply,processing-efficiency,R,Matrix,Eval,Apply,Processing Efficiency,我有一个巨大的矩阵,我想计算几个表达式 lexpr <- sapply(c("col1 > col2", "col1 > col3", "col2 == 15"), function(x) parse(text=x)) M <- matrix(data=sample(1:100, 30), nrow = 10, ncol = 3, dimnames = list(1:10, c('col1','col2','col3'))) M <- as.data.frame(

我有一个巨大的矩阵,我想计算几个表达式

lexpr <- sapply(c("col1 > col2", "col1 > col3",  "col2 == 15"), function(x) parse(text=x))
M <- matrix(data=sample(1:100, 30), nrow = 10, ncol = 3, dimnames = list(1:10, c('col1','col2','col3')))
M <- as.data.frame(M)
logi <- with(M, lapply(lexpr, function(x) eval(x)))
lexpr