my code:
s<-function(v,k){
ifelse(k>length(v),print("error,k>length(v)"),return(v-k))
}
v=1:5
k=6
s(v,k)
output:
> s(v,k)
[1] "error,k>length(v)"
[1] "error,k>length(v)"
Why is this printing twice? thanks
Is there some kind of error handler I could use here?
Aucun commentaire:
Enregistrer un commentaire