I've never noticed this before, though it's probably not new. In 1.2.3 for Windows, if I print a short vector the formatting is different than if I print a long one, whether or not they fit on one line. The short/long split appears to be between 9 and 10 elements: > 1:9 [1] 1 2 3 4 5 6 7 8 9 > 1:10 [1] 1 2 3 4 5 6 7 8 9 10 > sqrt(1:9) [1] 1.000000 1.414214 1.732051 2.000000 2.236068 2.449490 2.645751 2.828427 [9] 3.000000 > sqrt(1:10) [1] 1.000000 1.414214 1.732051 2.000000 2.236068 2.449490 2.645751 2.828427 [9] 3.000000 3.162278 The spacing between the integer values is different, and there's a space before the "[1]" in the longer vectors. Is this intentional? What's the reasoning for this difference? Duncan Murdoch -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Duncan Murdoch <murdoch@stats.uwo.ca> writes:> I've never noticed this before, though it's probably not new. In > 1.2.3 for Windows, if I print a short vector the formatting is > different than if I print a long one, whether or not they fit on one > line. The short/long split appears to be between 9 and 10 elements: > > > 1:9 > [1] 1 2 3 4 5 6 7 8 9 > > 1:10 > [1] 1 2 3 4 5 6 7 8 9 10 > > > sqrt(1:9) > [1] 1.000000 1.414214 1.732051 2.000000 2.236068 2.449490 2.645751 > 2.828427 > [9] 3.000000 > > sqrt(1:10) > [1] 1.000000 1.414214 1.732051 2.000000 2.236068 2.449490 2.645751 > 2.828427 > [9] 3.000000 3.162278 > > > The spacing between the integer values is different, and there's a > space before the "[1]" in the longer vectors. > > Is this intentional? What's the reasoning for this difference?The spacing is to print all elements in the same field width, and 10 wouldn't look good in a field of with 2. I don't think that could be much different (compare 1:100 and 1:99). The labels would seem to be generated to make room for the label with the longest possible width, which is slightly botched since that width need not be used by any of the labels. Submit a patch? -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Wed, 16 May 2001, Duncan Murdoch wrote:> I've never noticed this before, though it's probably not new. In > 1.2.3 for Windows, if I print a short vector the formatting is > different than if I print a long one, whether or not they fit on one > line. The short/long split appears to be between 9 and 10 elements: > > > 1:9 > [1] 1 2 3 4 5 6 7 8 9 > > 1:10 > [1] 1 2 3 4 5 6 7 8 9 10 > > > sqrt(1:9) > [1] 1.000000 1.414214 1.732051 2.000000 2.236068 2.449490 2.645751 > 2.828427 > [9] 3.000000 > > sqrt(1:10) > [1] 1.000000 1.414214 1.732051 2.000000 2.236068 2.449490 2.645751 > 2.828427 > [9] 3.000000 3.162278 > > > The spacing between the integer values is different, and there's a > space before the "[1]" in the longer vectors. > > Is this intentional? What's the reasoning for this difference?I guess so. For the first, the elements will line up:> options(width=40) > 1:50[1] 1 2 3 4 5 6 7 8 9 10 11 12 [13] 13 14 15 16 17 18 19 20 21 22 23 24 [25] 25 26 27 28 29 30 31 32 33 34 35 36 [37] 37 38 39 40 41 42 43 44 45 46 47 48 [49] 49 50 and that shows you the reason for the space too. FWIW, S-PLUS 3.4 does the same things. -- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, stats.ox.ac.uk/~ripley University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._