Do there need to be the same number of y-values for each x-value when using tapply?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Do there need to be the same number of y-values for each x-value when using tapply?

JLfish
Hi everyone,
I'm trying to fit a set of data to a non-linear distribution (namely, rates of
insect development at different temperatures), and I'm trying to do this using
the selfStart and GetInitial functions. (I'd of course be open to alternative
suggestions!). However, I keep running into this error:

Error in tapply(y, x, mean, na.rm = TRUE) :
arguments must have same length

I created a post on stackoverflow that includes the data and my code, and a
more in-depth explanation. I would be grateful if someone could have a look
and let me know where I'm going wrong!

https://stackoverflow.com/questions/51119314/using-tapply-when-you-have-different-n-for-each-treatment


Thanks very much,
Jenny
        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Do there need to be the same number of y-values for each x-value when using tapply?

Martin Maechler-8
The answer to your Q is surely a "no": That's exaxtly the point of tapply
that the number of y values may vary. The msg tells you that the x & y full
vectors must have the same length.

Hoping that helps.
Martin

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.