Displaying 1 result from an estimated 1 matches for "laugel".
Did you mean:
langel
2006 Jul 06
2
use of apply in a data frame on a row by row basis
Hello all,
I'm trying to use the apply function on a data frame,
by applying a function that takes a one row data.frame as argument .
Here's the example :
myfun = function(x) paste(x$f1 , x$f2)
df = data.frame(f1 = c(1,4,10),f2 = "hello")
apply(df,1,myfun) ==> Does not work (I get "character(0)" )
Though : myfun(df[1,]) works,
and myfun(df) works as well.
So if