Consider the following data.frame:
df <- data.frame(ID = 1:2, Location = c("Love, Love, Singapore, Love, Europe, United States, Japan, Amazon, Seattle, Orchard Road, Love",
"Singapore, Singapore, Singapore") , stringsAsFactors = FALSE)
I would like to find out the Unique Data from the above mentioned df$Location column, that is I would like to obtain a new column, which consists of only the unique location names, exactly like the dataframe provided below;
df <- data.frame(ID = 1:2, Location = c("Love, Love, Singapore, Love, Europe, United States, Japan, Amazon, Seattle, Orchard Road, Love",
"Singapore, Singapore, Singapore") ,
Unique.Location = c("Love, Singapore, Europe, United States, Japan, Amazon, Seattle, Orchard Road",
"Singapore"), stringsAsFactors = FALSE)
Any Inputs will be really appreciable.