Jenny Liu
2018-Jul-06 14:29 UTC
[R] Do there need to be the same number of y-values for each x-value when using tapply?
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]]
Martin Maechler
2018-Jul-08 07:54 UTC
[R] Do there need to be the same number of y-values for each x-value when using tapply?
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]]