The apply function is the way to iterate over rows or columns of
dataframes or matrices. An example would have made this process easier
testing and I have given up doing that job for
You might try:
apply(observs, 1, function(x) Fn(par, x) )
On Jun 16, 2009, at 11:08 AM, Stu @ AGS wrote:
Why not just use rowSums?
Ronggui
2009/6/16 Stu @ AGS :
> Hello!
>
>
>
> I am trying to write a function with vector and data.frame parameters that
> uses the sum() function and values from the rows of the data.frame.
>
> I need to pass this function as a parameter to optim().
>
>
>
> My starting
Hello!
I am trying to write a function with vector and data.frame parameters that
uses the sum() function and values from the rows of the data.frame.
I need to pass this function as a parameter to optim().
My starting point is:
observs <- data.frame(y, x1, x2, x3)
Fn <- function(par,
3 matches
Mail list logo