[R] Strange behaviour of sapply function.

Jim Lemon drj|m|emon @end|ng |rom gm@||@com
Thu Sep 12 11:25:31 CEST 2019

Hi bickis,
Putting on my dark glasses and flailing about with a big white stick*,
I would suggest that you look at what "atv" actually produces from
those three objects. I wouldn't be surprised to find quite different

* blind guess

On Thu, Sep 12, 2019 at 7: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.

More information about the R-help mailing list