Hello,

 

I need to remove columns in a matrix.  The number of columns varies from 0
to n.  I can't figure out how to specify the zero case.

 

aa <-matrix(runif(5^2),5,5)

 

#remove column 3

aa[,-3]

 

#remove no column

aa[,-NULL]

Error in -NULL : invalid argument to unary operator

 

I know I could use ifelse, but it would complicate my model a lot. Is there
a direct way to specify that the number of columns to remove is 0?

 

Pierre Lapointe


	[[alternative HTML version deleted]]

