mapply(), was Re: [Rd] sprintf

Peter Dalgaard p.dalgaard at biostat.ku.dk
Tue Feb 15 14:41:03 CET 2005


Prof Brian Ripley <ripley at stats.ox.ac.uk> writes:

> sprintf() in R-devel is now vectorized, re-cycling its arguments,
> including fmt, as required.

Thanks, Brian. 

This leaves me with one question: what is actually the wisdom behind
the USE.NAMES default in mapply? Seems to me that it gets in the way
more often that it is useful (and has some real problems with
recycling, clearly). Thomas?

> >>> mapply(sprintf, "%04d %s", 1:3, "abc", USE.NAMES=FALSE)
> >> [1] "0001 abc" "0002 abc" "0003 abc"

> >>     if (USE.NAMES && length(dots) && is.character(dots[[1]]) &&
> >>         is.null(names(answer)))
> >>         names(answer) <- dots[[1]]
> >> )


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907



More information about the R-devel mailing list