I'm having a hard time with an if_else statement in R/dplyr. My goal is to look in a column for specific Nexus phone models and create a new column that says "android phone" if the nexus values are found, or refers to the device_type column in the same row. I keep getting an error with the false condition of the following code. How can I get it to refer to the other column? Also wondering if there is a way to make the if conditions more concise. newdevice is the column I'm creating. Thanks!
#Correct Nexus issue
df$newdevice <- if_else(df$wurfl_model_name == "Nexus 5" | df$wurfl_model_name == "Nexus 7" | df$wurfl_model_name == "Nexus 6P" | df$wurfl_model_name == "Nexus 6" | df$wurfl_model_name == "Nexus 5X" | df$wurfl_model_name == "Nexus" | df$wurfl_model_name == "Nexus 4", "android phone", df$device_type)