name_type |
---|
apple-watch |
apple-tablet |
apple |
apple-orange-watch |
apple-orange-tablet |
apple-orange |
How do I add -laptop
to the elements that don't end with -watch
or -tablet
? For example, row 3 would become apple-laptop
; row 6 would become apple-orange-laptop
.
library(tidyverse)
tibble(
name_type = c(
"apple-watch", "apple-tablet", "apple",
"apple-orange-watch", "apple-orange-tablet", "apple-orange"
)
) -> toy_data