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

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -