Dear Tristan,
This isn't a bug, but reflects the way that print methods are supposed to
work -- in addition to printing an object they return the object invisibly.
When you call print at the command line, you don't see the invisible
result, but the result is returned by print and will be returned by your
function if it is in the last statement of the function, and then printed
if not assigned.
For example:
> fun <- function(x) print(x)
> fun(1)
[1] 1
[1] 1
> x <- print(1)
[1] 1
> x
[1] 1
>
I hope that this helps,
John
At 10:40 AM 8/29/2002 +0200, lorino@vet-alfort.fr wrote:
Since many years, I have a problem with S-Plus (v2000 and v6, Windows NT,
2000 and Xp): when I put a "print(toto)" command
somewhere in a program, I already have "toto" printed two times!
Why?
Has anyone this problem too?
-----------------------------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: jfox@mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox
-----------------------------------------------------
|