s-news
[Top] [All Lists]

[S] Curious behaviour of print

To: s-news@wubios.wustl.edu
Subject: [S] Curious behaviour of print
From: molinari@kispi.unizh.ch (Luciano Molinari)
Date: Wed, 28 Apr 1999 14:58:28 +0100
Sender: owner-s-news@wubios.wustl.edu
I have come across a curious phenomenon, which I had not noticed before. It
seems that print behaves differently, whether a vector as names or not (this
adds to other, more annoying, differences between named and unnamed vectors,
such as the result of is.vector).
----------
S+>options(digits=3)
S+>zz1_sort(rnorm(10))
S+>zz1
 [1] -2.4296 -0.8966 -0.5614 -0.5177 -0.0236  0.1401  0.4715  0.6122  0.8082
1.7956
S+>names(zz1)_LETTERS[seq(10)]
S+>zz1
     A      B      C      D       E    F     G     H     I   J 
 -2.43 -0.897 -0.561 -0.518 -0.0236 0.14 0.471 0.612 0.808 1.8
-----------------
It appears that, with names, each component is individually printed to 3
significant digits (although in this case I would prefer F=0.140 and
J=1.80), while, without names, the whole vector is adjusted to the smallest
component.
Any comment?
L. Molinari

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>