stephenslab / susieR

R package for "sum of single effects" regression.
https://stephenslab.github.io/susieR
Other
174 stars 44 forks source link

Use a more robust check for class membership #106

Closed CreRecombinase closed 4 years ago

CreRecombinase commented 4 years ago

I got some warnings running susie (I'd be happy to generate a reproducible example if you'd like), so I thought I'd make a pull request fixing the problem. inherits(foo,"bar") is more or less equivalent to any(class(foo)=="bar"). In general it's not a good idea to assume the return value of class is scalar. The warning was :

Warning message:
In if (class(res) == "susie") res = res$alpha :
  the condition has length > 1 and only the first element will be used

and comes from setting

_R_CHECK_LENGTH_1_CONDITION_=verbose
_R_CHECK_LENGTH_1_LOGIC2_=verbose

in .Renviron

gaow commented 4 years ago

Thanks Nick this is a good catch!