[R] lapply and dynamically linked functions

Jason Nielsen jdn at cs.sfu.ca
Wed Feb 11 06:54:40 CET 2004

Hi all,

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

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


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:


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.


More information about the R-help mailing list