I'm trying to execute my own function named myfun(x,y)
on a S4 object using lapply()
, but don't know if it's the appropriate way to do it.
My S4 object dblist
contains 3 slots and I would like to fill the empty plot df.para
using my function that takes in arguments df.list
and df.para
. (the argument df.para
is used to create sub slot (e.g. $Name ; $Eval ...etc))
So I tried this :
> lapply(dblist@df.list, myfun(x,y) , y=dblist@df.para)
Error: object 'x' not found
Here is a description of the object dblist
:
> str(dblist)
Formal class 'dblist' [package ".GlobalEnv"] with 3 slots
..@ df.list :List of 102
.. ..$ :'data.frame': 81 obs. of 3 variables:
.. .. ..$ Parametre: Factor w/ 81 levels "1.","10.","11.",..: 77 79 76 80 74 81 75 78 1 13 ...
.. .. ..$ valeur1 : Factor w/ 69 levels "","1/2-1/2","1522",..: 55 27 5 11 20 4 3 2 24 26 ...
.. .. ..$ valeur2 : Factor w/ 73 levels "","]","a6","b5",..: 2 2 2 2 2 2 2 2 28 21
...
.. .. [list output truncated]
..@ df.para : list()
..@ df.coups: list()