[R] don't print object attributes on screen

jim holtman jholtman at gmail.com
Sun Jan 18 17:10:02 CET 2009


Is this what you want:

> y <- scale(x)
> str(x)
 int [1:10] 1 2 3 4 5 6 7 8 9 10
> str(y)
 num [1:10, 1] -1.486 -1.156 -0.826 -0.495 -0.165 ...
 - attr(*, "scaled:center")= num 5.5
 - attr(*, "scaled:scale")= num 3.03
> y
            [,1]
 [1,] -1.4863011
 [2,] -1.1560120
 [3,] -0.8257228
 [4,] -0.4954337
 [5,] -0.1651446
 [6,]  0.1651446
 [7,]  0.4954337
 [8,]  0.8257228
 [9,]  1.1560120
[10,]  1.4863011
attr(,"scaled:center")
[1] 5.5
attr(,"scaled:scale")
[1] 3.027650
> as.vector(y)
 [1] -1.4863011 -1.1560120 -0.8257228 -0.4954337 -0.1651446  0.1651446
 0.4954337  0.8257228  1.1560120
[10]  1.4863011
>


On Sun, Jan 18, 2009 at 1:55 AM, Pedro Mardones <mardones.p at gmail.com> wrote:
> Dear all;
> I have a function written in R that returns as a list of values as
> output that has associated some user defined attributes to it. How can
> hide these attributes when printing the output on screen? I'm using
> R-2.8.1 on WinXP....it's like hiding the attr of the output from the
> scale function....
> Thanks in advance
> PM
>
> ______________________________________________
> 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