I have a dataframe called "data":
data <-
x y
green-dog 3
blue-dog 4
red-cat 5
yellow-cat 6
I need to create a new variable called "type", like this:
data <-
x y type
green-dog 3 dog
blue-dog 4 dog
red-cat 5 cat
yellow-cat 6 cat