[Fwd: [R] drop=F in []

David Meyer david.meyer at ci.tuwien.ac.at
Wed Jul 25 16:40:55 CEST 2001


David Meyer wrote:
> 
> Agustin Lobo wrote:
> >
> > Within a program, I subset a data matrix. Sometimes
> > it comes to remain one single row (indivual) out of the
> > subseting. The fact that the single row becomes
> > a vector with dim(x)=NULL instead of a matrix
> > with dim(x)=c(1,n), is inconvenient for further operations
> > in the program.
> >
> > I thought that drop=F would solve this problem but...
> >
> > lets a be:
> >
> > > a
> >           [,1]     [,2]      [,3]
> > [1,] 0.3249816 1.184596 1.0408749
> > [2,] 1.4722996 1.408512 0.3768964
> > [3,] 1.2737683 1.811588 1.9108336
> > [4,] 1.8235127 1.260909 1.5995097
> >
> > Then
> >
> > > a[a[,1]<1,]
> > [1] 0.3249816 1.1845962 1.0408749
> >
> > > dim(a[a[,1]<1,])
> > NUL
> >
> > But,
> >
> > > a[a[,1]<1,drop=F]
> > [1] 0.3249816 1.1845962 1.0408749
> > > dim(a[a[,1]<1,drop=F])
> > NULL
> >
> > No way to get dim(a[a[,1]<1,]) equal to c(1,3) ?
> >
> 
> certainly:
> 
>  a[a[,1]<1,,drop=F]
> 
> (drop is the THIRD parameter...)
> 
> -d
> 
> > Thanks
> >
> > Agus
> >
> > Dr. Agustin Lobo
> > Instituto de Ciencias de la Tierra (CSIC)
> > Lluis Sole Sabaris s/n
> > 08028 Barcelona SPAIN
> > tel 34 93409 5410
> > fax 34 93411 0012
> > alobo at ija.csic.es
> >
> > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> > r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> > Send "info", "help", or "[un]subscribe"
> > (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 
> --
> Mag. David Meyer                        Wiedner Hauptstrasse 8-10
> Vienna University of Technology         A-1040 Vienna/AUSTRIA
> Department for Statistics, Probability  Tel.: (+431) 58801/10772
> Theory and Actuarial Mathematics        mail: david.meyer at ci.tuwien.ac.at

-- 
Mag. David Meyer			Wiedner Hauptstrasse 8-10
Vienna University of Technology		A-1040 Vienna/AUSTRIA
Department for Statistics, Probability	Tel.: (+431) 58801/10772
Theory and Actuarial Mathematics	mail: david.meyer at ci.tuwien.ac.at
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list