Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.LNX.4.44.0305150854160.8191-100000@gannet.stats>
Date: 2003-05-15T08:01:04Z
From: Brian Ripley
Subject: error-prone feature?
In-Reply-To: <D15343265276D31197BC00A024A6C110774051@EXS_BDC>

Well, that is in all good texts on R, together with the 
solution: drop=FALSE.  See ?"[" for the on-line details.

`S Programming' says

  S programmers have often overlooked these rules, which can result
  in puzzling or incorrect behaviour when just one observation or
  variable meets some selection criterion.

I suggest you get yourself a copy and read it.


On Thu, 15 May 2003, Khamenia, Valery wrote:

>   while looking why the cclust(cclust) doesn't work for 1-dimensional data,
>   I've found unpleasant behavior in semantics of R. Indeed:
> 
>     is.matrix(matrix(cbind(c(1,2,3,4)),ncol=2)[1:2,])  == TRUE
> 
>   but:
> 
>     is.matrix(matrix(c(1,2))[1:2,]) == FALSE


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595