[R] Strange behaviour of sapply function.

Eric Berger er|cjberger @end|ng |rom gm@||@com
Thu Sep 12 11:24:35 CEST 2019


Can you create a reproducible example?
You don't show: income, atv, sktaxb, sktax



On Thu, Sep 12, 2019 at 12:04 PM <bickis using math.usask.ca> wrote:

> Here is are a few lines of my R session:
>
> > class(income)
> [1] "integer"
> > class(sapply(1000*income-999,atv,sktaxb,sktax))
> [1] "numeric"
> > class(sapply(1000*income-1001,atv,sktaxb,sktax))
> [1] "list"
>
> Although "income" is a numeric array, and sapply works as expected
> returning an array (the function "atv" returns a single numeric argument),
> if subtract a large enough number from the first argument, the sapply
> function now wants to return a list?   Am I missing something?
>
> I am running version 3.3.2 on Mac OS 10.9.9
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list