r - Changing df and col in a Function -
i having trouble creating function allow me to, on fly, change data frame (df) , column (col). each column has 2 possible entries, e.g., left or right.
conceptually @ least, i'm trying do:
myfun = function(df, col){ mean( df$rt[ df$col == levels(df$col)[1] ] ) - mean( df$rt[ df$col == levels(df$col)[2] ] )
so enter like:
myfun( df = m, col = turn_direction )
any appreciated.
Comments
Post a Comment