[R] Can't Destroy Dim Names

Greg Snow Greg.Snow at imail.org
Tue Jan 13 02:42:59 CET 2009


Your mat variable is not a matrix, but a vector (a named vector), therefore it does not have dimensions or dimnames.

Try names(mat) <- NULL

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Gundala Viswanath
> Sent: Monday, January 12, 2009 6:32 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Can't Destroy Dim Names
> 
> Dear all,
> 
> I have the following matrix:
> 
> > str(mat)
> Named chr [1:32268] "yQAAA" "jQAAQ" "UQAAg" "FQAAw" "1QABA" ...
>  - attr(*, "names")= chr [1:32268] "CAAAAAAAAA" "CAAAAAAAAC"
> "CAAAAAAAAG" "CAAAAAAAAT" ...
> 
> 
> I want to destroy the attribute yielding only this:
> 
> > str(mat)
> Named chr [1:32268] "yQAAA" "jQAAQ" "UQAAg" "FQAAw" "1QABA" ...
> 
> 
> But why this command fail to do it?
> 
> > dimnames(mat) <- NULL
> 
> Btw, the object size for keeping matrix with dim names is greater
> than without, right?
> 
> 
> 
> - Gundala Viswanath
> Jakarta - Indonesia
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list