[R] lapply and dynamically linked functions

Jason Nielsen
2004-02-11T05:54:40Z

Hi all,

I'm trying to use lapply on a list with the following command:

out<-lapply(mylist,myfun,par1=p,par2=d)               (1)

where

myfun<-function(x,par1,par1) {.....}                  (2)

now this function is in fact a wrapper for some Fortran code I have
written so I think this might be the problem.  When I call lapply() as in
(1)  I get the following message:

Error in get(x, envir, mode, inherits) : variable "mylist" was not
found

but if I say do:

out<-lapply(mylist,sum)

it returns a nice list with the sums of the elements in the list.  So
after all that I guess my question is does this have to do with the fact
that my function is a wrapper for my Fortran code (which works fine on its
own.. and if I use a loop as opposed to lapply() )?  I imagine that lapply
which is a wrapper for the .Internal lapply might have some trouble with
my Fortran wrapper?  Is this the case or is it something dumb on my end?
Any input is appreciated.

Cheers,
Jason