[R] matrix manipulation question

Stéphane Adamowicz stephane.adamowicz at avignon.inra.fr
Mon Mar 30 09:59:36 CEST 2015

Le 27 mars 2015 à 18:01, David Winsemius <dwinsemius at comcast.net> a écrit :

> On Mar 27, 2015, at 3:41 AM, Stéphane Adamowicz wrote:
>> Well, it seems to work with me.
> No one is doubting that it worked for you in this instance. What Peter D. was criticizing was the construction :
> complete.cases(t(Y))==T
> ... and it was on two bases that it is "wrong". The first is that `T` is not guaranteed to be TRUE. The second is that the test ==T (or similarly ==TRUE) is completely unnecessary because `complete.cases` returns a logical vector and so that expression is a waste of time.

Indeed, You are right, the following code was enough :
«  Z <- Y[, complete.cases(t(Y) ] »

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 ?


	[[alternative HTML version deleted]]

More information about the R-help mailing list