In R, you can convert a set of strings to a set of integers using the as.integer() function.
In this example,
string_set1 <- c('1', '2', '3', '4', '5')
int_set1 <- as.integer(string_set1)
print(int_set1)
[1] 1 2 3 4 5
In this example,
string_set2 <- c('10', '20', '30', '40', '50')
int_set2 <- sapply(string_set2, as.integer)
print(int_set2)
[1] 10 20 30 40 50
In this tutorial, we learned How to Convert a Set of Strings to a Set of Integers in R language with well detailed examples.