I am using the new dplyr package and am encountering some difficulties.
mutate(df,isOdd=digit%%2) or transform(df,isOdd=digit%%2)
Both of them work great.
I ask a question about passing a custom method.
IsItOdd <- function(x) { if(x%%2==0) result<-"even" else result<-"odd" return(result) } transform(df,isOdd=IsItOdd(digit))
This does not work, because the entire column of the entire digit is passed to the function. Is there a way to make this work by simply passing this cell to a function instead of the entire column?
r dplyr
prog_guy
source share