mardi 4 mai 2021

Why ifelse with character statement is not working?

I am having problem today to understand how functions works.

This is my code:

my_fun<- function(x){
        ifelse(as.character(x) == 'Species',
              a<- iris %>% select(x),
              a<- iris*2)
        
        a
}

my_fun(x = Species)

Why is it not working?

Aucun commentaire:

Enregistrer un commentaire