I have vector data x in the following form:

"Alpha Omicron Pi; Alpha Omicron Pi"                            
"Chi Omega"                                                           
"Chi Phi"                                               
"Pi Kappa Phi; Alpha Tau Omega"                                
"Pi Kappa Phi; Pi Kappa Alpha"

Have tried using the below but I am stuck:-

a1 <- strsplit(x,split="; ")

Need to replace each element of x with the last element of the vector of strings that results from running strsplit on it.

I expect the Output to be in this form:-

"Alpha Omicron Pi"                            
"Chi Omega"                                                           
"Chi Phi"                                               
"Alpha Tau Omega"                                
"Pi Kappa Alpha"

0 Answers