On Fri, 2004-06-11 at 20:09, Robin Hankin wrote:
> Hi
> 
> I want to extract rows of a matrix, and preserve rownames even if only
> one row is selected.  

The infamous drop=TRUE default.  help("[") goes into this.

Your toy example, two ways:

> a <- matrix(1:9,3,3)
> rownames(a) <- letters[1:3]
> colnames(a) <- letters[1:3]
> a[1,,drop=FALSE]
  a b c
a 1 4 7
> a[1,,drop=TRUE]
a b c 
1 4 7 

Does that help?

Cheers

Jason

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to