R语言 || 参数大于1

lnxxn5zx  于 2023-10-13  发布在  其他
关注(0)|答案(1)|浏览(142)

下面的if()函数由于R 4.2.0更新而中断,当&&||与长度大于1的参数一起使用时,会抛出警告。当我从esc包运行this function时,它被调用了,我不确定如何前进。
什么是最稳健/最经得起未来考验的修复方法?

if ((missing(gain1mean) || is.null(gain1mean) || is.na(gain1mean)) &&
      ((missing(pre1mean) || is.null(pre1mean) || is.na(pre1mean)) ||
       (missing(post1mean) || is.null(post1mean) || is.na(post1mean)))) {
    warning("Either `pre1mean` and `post1mean` or `gain1mean` must be specified.", call. = F)
    return(esc_generic(es = NA, v = NA, es.type = es.type, grp1n = NA, grp2n = NA, info = NA, study = NA))
  }
rsl1atfo

rsl1atfo1#

是的,看起来下面的修复了它。

any(missing(gain1mean), is.null(gain1mean), is.na(gain1mean)) &&
  any(missing(pre1mean), is.null(pre1mean), is.na(pre1mean)) ||
  any(missing(post1mean), is.null(post1mean), is.na(post1mean))

相关问题