[R] Problem with apply list to function: numerical expression has 4 elements: only the first used
maria.mi8 at gmx.de
Sun May 24 00:21:12 CEST 2015
I want to try R for statistics.
Therefore, I defined a function f with parameters m and k, which calculates
a to sqrt(x) proportional density function:
f <- function(m,k)((1/(sum(sqrt(1:m))))*sqrt(k))
A function F sums the results in order to get a distribution function:
F <- function(m,i)(sum(f(m,1:i)))
It works e.g. for m=4:
If I want to see all results for m=4, I write
In 1:i : numerical expression has 4 elements: only the first used
what does the error message mean?
and how can I solve it?
I've already tried rapply but I get the same error and googled for a while
but there is nowhere a satisfying answer
Can someone help me here?
many thanks in advance,
View this message in context: http://r.789695.n4.nabble.com/Problem-with-apply-list-to-function-numerical-expression-has-4-elements-only-the-first-used-tp4707588.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help