[R] Can't Destroy Dim Names

jim holtman jholtman at gmail.com
Tue Jan 13 02:42:06 CET 2009


Is this what you want:

> x <- c(a=1, b=2, c=3)
> str(x)
 Named num [1:3] 1 2 3
 - attr(*, "names")= chr [1:3] "a" "b" "c"
> names(x) <- NULL
> x
[1] 1 2 3
>

On Mon, Jan 12, 2009 at 8:32 PM, Gundala Viswanath <gundalav at gmail.com> wrote:
> 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?




More information about the R-help mailing list