[Rd] Print bug for matrix(list(NA_complex_, ...))
William Dunlap
wdunlap at tibco.com
Wed Jun 3 17:58:15 CEST 2009
> -----Original Message-----
> From: r-devel-bounces at r-project.org
> [mailto:r-devel-bounces at r-project.org] On Behalf Of Martin Maechler
> Sent: Wednesday, June 03, 2009 2:37 AM
> To: Wacek Kusnierczyk
> Cc: r-devel at r-project.org
> Subject: Re: [Rd] Print bug for matrix(list(NA_complex_, ...))
>
> >>>>> "vQ" == Wacek Kusnierczyk
> <Waclaw.Marcin.Kusnierczyk at idi.ntnu.no>
> >>>>> on Wed, 03 Jun 2009 10:43:25 +0200 writes:
>
> vQ> Stavros Macrakis wrote:
> >> 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.
>
> vQ> on ubuntu 8.04 with r 2.10.0 r48703 there is almost
> no problem (still
> vQ> some unnecessary spaces):
>
> vQ> [,1] [,2]
> vQ> [1,] NA NA
>
> thank you, Waclav.
>
> I don't see any unnecessary space (or other CPU problems),
> using another Linux variant (RHEL 5)
> in the three R version
> 2.9.0 ,
> 2.9.0-patched (r48700)
> 2.10.0-devel (r48700)
>
> Can other Windows (or ...) users confirm problems in R 2.9.0
> (or newer) ?
I just tried it on 2.9.0 on the Windows GUI (RGui.exe)
and saw similar problems. When printing to the
command window, with either print(val) or show(val) it took
a very long time and put $'s at the ends of the lines
(indicating that there was text beyond the edge of the window).
I used sink() to put the output into a file and then print() and
show() acted quickly. The resulting file had 119 character
lines, consisting mainly of trailing blanks:
> readLines("c:/temp/val.txt") # output of print(val);show(val);str(val)
[1] " [,1]
"
[2] "[1,]
"
[3] " [,2]
"
[4] "[1,]
"
[5] " [,1]
"
[6] "[1,]
"
[7] " [,2]
"
[8] "[1,]
"
[9] "List of 2"
[10] " $ : cplx NA"
[11] " $ : cplx NA"
[12] " - attr(*, \"dim\")= int [1:2] 1 2"
> nchar(readLines("c:/temp/val.txt"))
[1] 119 119 119 119 119 119 119 119 9 12 12 32
On Linux, using yesterday's 2.9.0, valgrind shows lots
of 'depends on uninitialized value' problems that could
explain the Linux-Windows difference in behavior:
> val<-matrix(list(NA_complex_,NA_complex_),1)
> val
==24859== Conditional jump or move depends on uninitialised value(s)
==24859== at 0x6F7E2F: vfprintf (in /lib/tls/libc-2.3.4.so)
==24859== by 0x7177A5: vsnprintf (in /lib/tls/libc-2.3.4.so)
==24859== by 0x6FF4E1: snprintf (in /lib/tls/libc-2.3.4.so)
==24859== by 0x809DDC1: Rf_EncodeReal (printutils.c:179)
==24859== by 0x8099AA9: Rf_PrintValueRec (print.c:359)
==24859== by 0x809A124: Rf_PrintValueEnv (print.c:956)
==24859== by 0x80584CA: Rf_ReplIteration (main.c:261)
==24859== by 0x8058572: R_ReplConsole (main.c:306)
==24859== by 0x8058BB8: run_Rmainloop (main.c:967)
==24859== by 0x8056A70: main (Rmain.c:33)
==24859==
==24859== Conditional jump or move depends on uninitialised value(s)
==24859== at 0x6F7E44: vfprintf (in /lib/tls/libc-2.3.4.so)
==24859== by 0x7177A5: vsnprintf (in /lib/tls/libc-2.3.4.so)
==24859== by 0x6FF4E1: snprintf (in /lib/tls/libc-2.3.4.so)
==24859== by 0x809DDC1: Rf_EncodeReal (printutils.c:179)
==24859== by 0x8099AA9: Rf_PrintValueRec (print.c:359)
==24859== by 0x809A124: Rf_PrintValueEnv (print.c:956)
==24859== by 0x80584CA: Rf_ReplIteration (main.c:261)
==24859== by 0x8058572: R_ReplConsole (main.c:306)
==24859== by 0x8058BB8: run_Rmainloop (main.c:967)
==24859== by 0x8056A70: main (Rmain.c:33)
==24859==
==24859== Conditional jump or move depends on uninitialised value(s)
==24859== at 0x6F7E4C: vfprintf (in /lib/tls/libc-2.3.4.so)
==24859== by 0x7177A5: vsnprintf (in /lib/tls/libc-2.3.4.so)
==24859== by 0x6FF4E1: snprintf (in /lib/tls/libc-2.3.4.so)
==24859== by 0x809DDC1: Rf_EncodeReal (printutils.c:179)
==24859== by 0x8099AA9: Rf_PrintValueRec (print.c:359)
==24859== by 0x809A124: Rf_PrintValueEnv (print.c:956)
==24859== by 0x80584CA: Rf_ReplIteration (main.c:261)
==24859== by 0x8058572: R_ReplConsole (main.c:306)
==24859== by 0x8058BB8: run_Rmainloop (main.c:967)
==24859== by 0x8056A70: main (Rmain.c:33)
==24859==
==24859== Conditional jump or move depends on uninitialised value(s)
==24859== at 0x6FA87A: vfprintf (in /lib/tls/libc-2.3.4.so)
==24859== by 0x7177A5: vsnprintf (in /lib/tls/libc-2.3.4.so)
==24859== by 0x6FF4E1: snprintf (in /lib/tls/libc-2.3.4.so)
==24859== by 0x809DDC1: Rf_EncodeReal (printutils.c:179)
==24859== by 0x8099AA9: Rf_PrintValueRec (print.c:359)
==24859== by 0x809A124: Rf_PrintValueEnv (print.c:956)
==24859== by 0x80584CA: Rf_ReplIteration (main.c:261)
==24859== by 0x8058572: R_ReplConsole (main.c:306)
==24859== by 0x8058BB8: run_Rmainloop (main.c:967)
==24859== by 0x8056A70: main (Rmain.c:33)
==24859==
==24859== Conditional jump or move depends on uninitialised value(s)
==24859== at 0x6F86E8: vfprintf (in /lib/tls/libc-2.3.4.so)
==24859== by 0x7177A5: vsnprintf (in /lib/tls/libc-2.3.4.so)
==24859== by 0x6FF4E1: snprintf (in /lib/tls/libc-2.3.4.so)
==24859== by 0x809DDC1: Rf_EncodeReal (printutils.c:179)
==24859== by 0x8099AA9: Rf_PrintValueRec (print.c:359)
==24859== by 0x809A124: Rf_PrintValueEnv (print.c:956)
==24859== by 0x80584CA: Rf_ReplIteration (main.c:261)
==24859== by 0x8058572: R_ReplConsole (main.c:306)
==24859== by 0x8058BB8: run_Rmainloop (main.c:967)
==24859== by 0x8056A70: main (Rmain.c:33)
==24859==
==24859== Conditional jump or move depends on uninitialised value(s)
==24859== at 0x6F86FA: vfprintf (in /lib/tls/libc-2.3.4.so)
==24859== by 0x7177A5: vsnprintf (in /lib/tls/libc-2.3.4.so)
==24859== by 0x6FF4E1: snprintf (in /lib/tls/libc-2.3.4.so)
==24859== by 0x809DDC1: Rf_EncodeReal (printutils.c:179)
==24859== by 0x8099AA9: Rf_PrintValueRec (print.c:359)
==24859== by 0x809A124: Rf_PrintValueEnv (print.c:956)
==24859== by 0x80584CA: Rf_ReplIteration (main.c:261)
==24859== by 0x8058572: R_ReplConsole (main.c:306)
==24859== by 0x8058BB8: run_Rmainloop (main.c:967)
==24859== by 0x8056A70: main (Rmain.c:33)
==24859==
==24859== Conditional jump or move depends on uninitialised value(s)
==24859== at 0x711183: _IO_padn (in /lib/tls/libc-2.3.4.so)
==24859== by 0x6F8713: vfprintf (in /lib/tls/libc-2.3.4.so)
==24859== by 0x7177A5: vsnprintf (in /lib/tls/libc-2.3.4.so)
==24859== by 0x6FF4E1: snprintf (in /lib/tls/libc-2.3.4.so)
==24859== by 0x809DDC1: Rf_EncodeReal (printutils.c:179)
==24859== by 0x8099AA9: Rf_PrintValueRec (print.c:359)
==24859== by 0x809A124: Rf_PrintValueEnv (print.c:956)
==24859== by 0x80584CA: Rf_ReplIteration (main.c:261)
==24859== by 0x8058572: R_ReplConsole (main.c:306)
==24859== by 0x8058BB8: run_Rmainloop (main.c:967)
==24859== by 0x8056A70: main (Rmain.c:33)
==24859==
==24859== Conditional jump or move depends on uninitialised value(s)
==24859== at 0x7111BF: _IO_padn (in /lib/tls/libc-2.3.4.so)
==24859== by 0x6F8713: vfprintf (in /lib/tls/libc-2.3.4.so)
==24859== by 0x7177A5: vsnprintf (in /lib/tls/libc-2.3.4.so)
==24859== by 0x6FF4E1: snprintf (in /lib/tls/libc-2.3.4.so)
==24859== by 0x809DDC1: Rf_EncodeReal (printutils.c:179)
==24859== by 0x8099AA9: Rf_PrintValueRec (print.c:359)
==24859== by 0x809A124: Rf_PrintValueEnv (print.c:956)
==24859== by 0x80584CA: Rf_ReplIteration (main.c:261)
==24859== by 0x8058572: R_ReplConsole (main.c:306)
==24859== by 0x8058BB8: run_Rmainloop (main.c:967)
==24859== by 0x8056A70: main (Rmain.c:33)
Bill Dunlap
TIBCO Software Inc - Spotfire Division
wdunlap tibco.com
>
> Regards,
> Martin Maechler
>
> >> 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!
> >>
>
> vQ> user system elapsed
> vQ> 0.648 0.056 155.843
> vQ> [,1] [,2]
> vQ> [1,] NA NA
> vQ> user system elapsed
> vQ> 0.648 0.056 155.843
>
> vQ> vQ
>
> vQ> ______________________________________________
> vQ> R-devel at r-project.org mailing list
> vQ> https://stat.ethz.ch/mailman/listinfo/r-devel
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
More information about the R-devel
mailing list