[Rd] Print bug for matrix(list(NA_complex_, ...))

From: Stavros Macrakis <macrakis_at_alum.mit.edu>
Date: Wed, 03 Jun 2009 01:19:50 -0400


In R 2.8.0 on Windows (tested both under ESS and under R Console in case there was an I/O issue)

There is a bug in printing val <- matrix(list(NA_complex_,NA_complex_),1).

> dput(val)
structure(list(NA_complex_, NA_complex_), .Dim = 1:2)

> print(val)

[,1]

[1,]

[,2]

[1,]

Note that a large number of spaces are printed instead of NA. Compare the unproblematic real case:

print(structure(list(NA_real_, NA_real_), .Dim = 1:2))

     [,1] [,2]
[1,] NA NA

Also, when printed in the read-eval-print loop, printing takes a very very long time:

> proc.time(); matrix(list(NA_complex_,NA_complex_),1); proc.time()

   user system elapsed
  74.35 0.09 329.45

[,1]

[1,]

[,2]

[1,]

   user system elapsed
  92.63 0.15 347.86

18 seconds runtime!

This does not happen with an explicit print:

> proc.time(); print(structure(list(NA_complex_,NA_complex_), .Dim = 1:2)); proc.time()

   user system elapsed
  92.63 0.15 355.90

[,1]

[1,]

[,2]

[1,]

   user system elapsed
  92.77 0.15 356.05


A perhaps related problem is that the NA's are not properly aligned in some cases:

> structure(list(NaN, NA_complex_, NA_real_, NA_complex_, NA_real_,
    NA_complex_, NA_real_, NA_complex_, NA_complex_, NA_complex_,
    NaN, NA_complex_, NA_complex_, NA_complex_), .Dim = c(2L, 7L))
     [,1] [,2] [,3] [,4] [,5] [,6] [,7]

[1,] NaN NA NA NA NA NaN NA
[2,] NA NA NA NA NA NA NA

It is perhaps hard to see this in email, but there is an extra space in front of the NAs at [1,7], [2,1], and [2,6].

Please let me know if you need additional information to troubleshoot this problem.

                -s

	[[alternative HTML version deleted]]

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed 03 Jun 2009 - 05:23:19 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 03 Jun 2009 - 09:35:16 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive