[R] matrix manipulation question

peter dalgaard pdalgd at gmail.com
Mon Mar 30 10:42:46 CEST 2015

> On 30 Mar 2015, at 09:59 , Stéphane Adamowicz <stephane.adamowicz at avignon.inra.fr> wrote:
> However, in order to help me understand, would you be so kind as to give me a matrix or data.frame example where « complete.cases(X)== T » or « complete.cases(X)== TRUE » would give some unwanted result ?

The standard problem with T for TRUE is if T has been used for some other purpose, like a time variable. E.g., T <- 0 ; complete.cases(X)==T.

complete.cases()==TRUE is just silly, like (x==0)==TRUE or ((x==0)==TRUE)==TRUE). 

(However, notice that x==TRUE is different from as.logical(x) if x is numeric, so ifelse(x,y,z) may differ from ifelse(x==TRUE,y,z).) 

Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com

More information about the R-help mailing list