我尝试了相关性和qgraph,并且几乎完成了...(请参阅:How to include p-values<0.05 in q-graphs?)如何在qgraph中一次过滤Pearson的r和p值?
#Thanks to Calvin Whealton, he gave us a very useful syntax
several years ago.
# see https://stackoverflow.com/users/4916708/calvin-whealton
#looping through all elements and setting values to NA when p-
values is greater than 0.05
>for(i in 1:nrow(cor_d100_partition_all3)){
for(j in 1:nrow(cor_d100_partition_all3)){
if(p.mat[i,j] > 0.05){cor_d100_partition_all3_mod[i,j] <- NA}}}
# For instance
#pick up r value
occor.r = occor$r
#pick up p value
occor.p = occor$p
# filtered r value and p value at once
occor.r[occor.p>0.05|abs(occor.r)<0.15] = 0
我想知道是否可以通过循环或其他方法一次过滤Pearson的r值和p值。