s-news
[Top] [All Lists]

print(quote=F) bug in S+ 6.0.3?

To: <bugs@insightful.com>
Subject: print(quote=F) bug in S+ 6.0.3?
From: "Buttrey, Samuel" <sebuttre@nps.navy.mil>
Date: Fri, 23 Aug 2002 09:50:46 -0700
Cc: <s-news@lists.biostat.wustl.edu>
Thread-index: AcJJ/z2oKRlx8b2uQ22s62meoRCzSwAwfdMA
Thread-topic: [S] calling update() inside a function
Hi. I've found what I think to be a bug in the behavior of print() which shows 
up on a list that includes a data.frame in S+ 6.0.3 release 2 for Windows.

> print (list (a = 1:3))
$a:
[1] 1 2 3 # Works well

> print (list (a = data.frame (1:3)))
$a:
   X1 
1 "1"
2 "2"
3 "3" # not so good

Notice the quotes, which do not appear using the same command in S-Plus 2000. 

I believe the "problem" lies in the fact that the result of format() on a 
data.frame carries class "matrix" in S+ 6.0. print.matrix() doesn't do what you 
would expect here.

Consider this:

> print (matrix ("1"), prefix = "a", quote=T)
     [,1] 
[1,] "1" 
> print (matrix ("1"), prefix = "a", quote=F)  # should have no quote
     [,1] 
[1,] "1" 

I see in print.default() that if the prefix() argument is present we call 
show() instead of the next method for print(). show() then calls print(). 
However, the quote=F argument doesn't propagate to the print() call.

Bug? Feature? User with too much time on his hands?

Slowly losing my mind,
Sam ("Quote = F") Buttrey


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