I create a data frame, and then run the ifelse function to add up and compare the columns of numeric info, while printing two different outcomes. Note I am loading readr and dplyr libraries.
I keep getting an 'Error in ifelse(., DT$A + DT$B > DT$C, print("1"), print("0")) : unused argument (print("0"))' in the following ...
library(readr)
library(dplyr)
DT <- data.frame(A=1:5, B=1:5*10, C=1:5*100)
DT
DT
A B C
1 1 10 100
2 2 20 200
3 3 30 300
4 4 40 400
5 5 50 500
DT %>%
ifelse(DT$A + DT$B > DT$C, print("1"), print("0"))
I suspect my grammar is the problem? I'm very much an R newbie.
Thanks!