It has isTRUE, but that is not vectorized, and in fact explicitly tests length==1, so
> isTRUE(c(TRUE,FALSE,NA)) [1] FALSE > isTRUE(c(TRUE,TRUE, TRUE)) # I thought I thaw a puddycat... ;-) [1] FALSE > Vectorize(isTRUE)(c(TRUE,FALSE,NA)) [1] TRUE FALSE FALSE (The latter would be silly as an implementation of is_true, of course.) -pd > On 20 Feb 2020, at 04:20 , Lijun Zhao <lijun.z...@adelaide.edu.au> wrote: > > > Some packages have the equivalent of that is_true function, which maps FALSE > and NA to FALSE and TRUE to TRUE. I don't think core R contains such a > function. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd....@cbs.dk Priv: pda...@gmail.com ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.