> Oh! So it is no good to use 'X' as an auxilliary argument to sapply?
Nope -- in fact, X is the first argument of sapply, as listed in
help(sapply) and in:
> args(sapply)
function(X, FUN, ..., simplify = T)
By passing X as a named argument, you are actually calling:
sapply(X=1, FUN=1:3, function(x,X) {print(x)})
hence the error. The same applies to lapply.
# David
--
David M Smith <dsmith@insightful.com>
S-PLUS Product Marketing Manager, Insightful Corp, Seattle WA
Tel: +1 (206) 283 8802 x360
Fax: +1 (206) 283 0347
Insightful Corporation provides analytical solutions leveraging
S-PLUS, StatServer, S-PLUS Analytic Server and consulting services.
See www.insightful.com for details.
> -----Original Message-----
> From: s-news-owner@lists.biostat.wustl.edu
> [mailto:s-news-owner@lists.biostat.wustl.edu]On Behalf Of Matt Calder
> Sent: Thursday, November 29, 2001 07:36
> To: s-news@lists.biostat.wustl.edu
> Subject: [S] Allowable names for sapply arguments
>
>
> Hi,
> This may have been discussed here before, but if not,
>
> > version
> Version 6.0 Release 1 for Sun SPARC, SunOS 5.6 : 2000
> > sapply(1:3, function(x,X) {print(x)}, X=1)
> Problem in sapply(1:10, function(x, X): ":" is not a function
> "1" is not a function
> "3" is not a function
>
> Hmm, it looks OK, what could be wrong?
>
> > sapply(1:3, function(x,y) {print(x)}, y=1)
> [1] 1
> [1] 2
> [1] 3
> [1] 1 2 3
>
> Oh! So it is no good to use 'X' as an auxilliary argument to sapply?
>
> Matt
>
>
>
>
> ---------------------------------------------------------------------
> This message was distributed by s-news@lists.biostat.wustl.edu. To
> unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
> the BODY of the message: unsubscribe s-news
|