Getting a vector containing total observations

I have a data frame that contains a column of city names that can be repeated:

City <- c("Raleigh", "Charlotte", "Greensboro", "Boone", "Boone", "Charlotte", "Cary")

I would like to create a vector that has only the city names without repetition, like the following:

[1] "Raleigh" , "Charlotte", "Greensboro", "Boone", "Cary"

Is there a function in R that does this?

unique(City)
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.