To create a set of strings in R, you can use the unique() function.
In this example,
stringSet
containing strings.stringSet <- c("Apple", "Banana", "Orange", "Grapes", "Apple")
uniqueSet <- unique(stringSet)
print(uniqueSet)
[1] "Apple" "Banana" "Orange" "Grapes"
In this example,
stringSet
containing strings.stringSet <- c("Apple", "Banana", "Orange", "Grapes", "Apple")
set <- set(stringSet)
print(set)
[1] "Apple" "Banana" "Orange" "Grapes"
In this tutorial, we learned How to create a Set of Strings in R language with well detailed examples.