Displaying 1 result from an estimated 1 matches for "myfun3".
Did you mean:
myfun
2006 Jul 06
2
use of apply in a data frame on a row by row basis
...;)
myfun2 = function(x) timeSeries(rnorm(3),timerange)
In this case, myfun2(df) returns only the result of the 1st row!
BUT
apply(df,1,myfun2) in this case, does work
But I haven't used the "$" notation to access one field
Now if I try (and that is the cas that bugs me currently) :
myfun3 = function(x) timeSeries(rep(x$f1,3),timerange)
myfun3(df)
Error in "rownames<-"(`*tmp*`, value = c("2001-04-11 02:00:00", "2001-04-18
02:00:00", :
length of 'dimnames' [1] is not equal to range of the array
(sorry for the translation : I'm using a fren...