Hi.
I'm trying to delete the second word of all my rows that contain two words. So for example, if a row has the value: "Argynnis childreni", I want the code to remove the second word so that I get the result "Argynnis".
Any ideas?
Here's some data. Specifically, I want to remove the 2nd word of all rows of the "species" column.
data.frame(
stringsAsFactors = FALSE,
species = c("Abraxaphantes sp",
"Abraxas sp","Acraea issoria","Actias sp","Agalope sp",
"Amesia sp"),
Individuals = c(2, 4, 19, 11, 7, 6),
Group = c("Other", "Other", "Butterfly", "Other", "Other", "Other"),
Group2 = c("insects/moths",
"insects/moths",NA,"insects/moths","insects/moths","insects/moths")
)
Thank you!!