Skip to content

matrix subset question

2 messages · tomas.larsson@gm.com, Brian Ripley

#
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,
#
On Thu, 24 Apr 2003 tomas.larsson at gm.com wrote:

            
No.

And you would not want to, for much of R is itself written in R and relies 
on the default behaviour of subsetting.