I have two lists of strings and want to find which strings are in both lists.
I tried converting the lists to vectors so that I could use intersect or setequal but that converted all the strings to numbers and (apologies if there's an obvious answer I can't figure out), I can't seem to convert the lists without that happening.
What's the best way forward?
EDIT: I have these data frames:
dput(s)
structure(list(V1 = structure(c(3L, 2L, 1L, 4L), .Label = c("24d2afb212410711de0e237e5435e104",
"2a3d9ca791a579a14883de538a012e24", "a90b03209a8095ec406809d89d5035c3",
"f271eb38cc409c6bfe9dcf2bfcab8471"), class = "factor")), .Names = "V1", row.names = c(NA,
-4L), class = "data.frame")
dput(r)
structure(list(V1 = structure(c(2L, 1L, 4L, 3L), .Label = c("24d2afb212410711de0e237e5435e104",
"2a3d9ca791a579a14883de538a012e24", "7320e2e921df862968954d4b60e2a80a",
"a9f47ec7c488d2bcddf2c1adc2bf6305"), class = "factor")), .Names = "V1", row.names = c(NA,
-4L), class = "data.frame")
I want to find the strings that are in both, i.e.
2a3d9ca791a579a14883de538a012e24
and 24d2afb212410711de0e237e5435e104
.
as.character() doesn't work for preserving those strings; is there something else that would work for converting them into factors or is there another operation that would work better?