In the below R function, I was wondering how I could get R to evaluate whether the object input outputs n or es?
Note: I will need to know the exact output of input, so I canNOT be using identical() etc.
Here is what I have tried with no success:
d = function(n, es){
input = if(length(n) > 1) n else if(length(es) > 1) es else n
if(input == n) cat("yes") else cat("No") # IF `input` is `n` cat("yes") otherwise cat("no")
}
d(n = c(2, 3), es = 1)
Aucun commentaire:
Enregistrer un commentaire