[R] matrix subset question

tomas.larsson@gm.com tomas.larsson at gm.com
Thu Apr 24 18:42:21 CEST 2003


Dear R-helpers,

If P is a matrix and I want to obtains one column from P I write:

x<-P[,k]

I always want to maintain the data as a matrix, even if the data is a
single row, to do that I have to write:

x<-P[,k,drop=FALSE]

Here is my question:
Is there any way that I can change my default to be drop=FALSE so that I do
not have to add this every single time?

Tomas,



More information about the R-help mailing list