I have a list of data.frames (d) that looks like this:
$ 1 :'data.frame': 1 obs. of 2 variables: ..$ index: int 2
..$ V1 : Factor w/ 125 levels "cgtsloqasmlkjybjlo,..:"
$ 2 :'data.frame': 1 obs. of 2 variables: ..$ index: int 2 ..$ V1 : Factor w/ 125 levels "ponlohlofdctlo,..:"
and so on for 1000 data.frames. I have to count the number of unique letters occurring in "cgtsloqasmlkjybjlo,..:" as well as in "ponlohlofdctlo,..:" and in the other 1000 data.frames. I tried a stupid function, but I'm not an expert so it is wrong also because it does not work:
Anyway I tried to split (but it does not work..):
chars = sapply(d, function(x) strsplit(as.character(d),""))
In addiction, I have to count the number of occurrences of "lo" in "cgtsloqasmlkjybjlo,..:" as well as in "ponlohlofdctlo,..:" and in the other 1000.
Edit: the desired output will be a data.frame:
Seq length(unique_letters) lo_occurrences cgtsloqasmlkjybjlo 13 2 ponlohlofdctlo 9 3 .............. ............ ............ dput output: dput(d[1:3])
structure(list(
1
= structure(1000L, .Label = c("jhgfilsouilohgucaksfiaaknajdauloadbayrzjdhad", "fjkhqurtglowqgbdahhmolovdethabvfdalo", "....", "V1"), class = "factor")), .Names = c("1", "2", "3"))