mardi 6 octobre 2020

When specific string is in certain variable, how to make value in another variable. ( in R )

Image down below is the first head(10) of the data frame.

enter image description here

Here's what I want to do. If the word "facebook" , "instagram", "youtube" is included in 'source' variable, change referral -> social in 'medium' variable.

I guess I can use if statement also filter function.., but I'm just stuck here and don't know where to start.. I'd like to know the technique for this.

referral2 <- mutate(referral, medium = ifelse( ))

Thanks..!

Aucun commentaire:

Enregistrer un commentaire