R-alpha: print 'problems': print(2^30, digits=12); comments at start of function()
Martin Maechler
Martin Maechler <maechler@stat.math.ethz.ch>
Tue, 20 May 97 17:11:18 +0200
Both of these bugs are not a real harm,
however, they have been annoying me for too long ... ;-)
1)
print(2^30, digits = 12) #- exponential form; unnecessarily!
formatC(2^30, digits = 12) #- shows you what you'd want above
## S-plus is okay here; note that the problem also affects
## paste(.) & format(.) :
options(digits=10)
paste(2^(4*1:8))
S-plus gives
[1] "16" "256" "4096" "65536" "1048576"
[6] "16777216" "268435456" "4294967296"
whereas R gives
[1] "16" "256" "4096" "65536"
[5] "1048576" "1.6777216e+07" "2.68435456e+08" "4.294967296e+09"
2) This one has been reported (in slightly different form)
>> Date: Mon, 10 Mar 1997 09:46:37 +0100 (MET)
>> From: Martyn Plummer <plummer@iarc.fr>
>> To: r-testers@stat.math.ethz.ch
>> #4) If you put a few lines of comments at the start of a function,
>> then the comments always appear *after* the first line of code.
This is REALLY painful; try, e.g.,
fcat <- function(..., f.dig= 4, f.wid = f.dig +5, f.flag = ' ', nl = TRUE,
file = "", sep = " ",
fill = FALSE, labels = NULL, append = FALSE)
{
## Purpose: Formatted CAT -- for printing 'tables'
## ----------------------------------------------------------------------
## Author: Martin Maechler, Date: 12 May 97
l <- unlist(lapply(list(...), formatC,
wid= f.wid, digits= f.dig, flag= f.flag))
cat(l, if(nl)"\n", file=file, sep=sep, fill=fill,labels=labels, append=append)
}
# and look how it prints:
fcat
Even worse, some comments are silently lost (yes, I know in some
sitatuations, S also loses comments) :
ex <-
##
## S version 4 likes comments like these.
## ----------- They automagically become on-line help.
## R just swallows them up into /dev/null...
##
function(a,b)
{
a + b
}
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-devel mailing list -- Read http://www.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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-