I have a list of character vectors in R representing sets of matching words. From this, I would like to extract a character vector that captures all the words that appear in the list of character vectors. I think that I know how to effectively move from the symbolic vector of words to the unique symbolic vector of words that have appeared. What I do not know how to do is to effectively collapse the list of character vectors into one character vector. Any advice on how to properly approach this or a common problem would be greatly appreciated!
Use unlist() :
unlist()
> x <- list(l1=c("a","b","c"), l2=c("b","d")) > unlist(x) l11 l12 l13 l21 l22 "a" "b" "c" "b" "d"
And to get unique values, just use unique :
unique
> unique(unlist(x)) [1] "a" "b" "c" "d"
Source: https://habr.com/ru/post/1300670/More articles:MySQL Trigger for specific mysql user only - sqlControlling FPU behavior in OpenMP? - c ++Help me convert a C ++ structure to C # - c ++Embedding IronPython in a C # application - import error on urllib - c #How to get a unique identifier for a protocol object - objective-cRSS aggregator using Google App Engine - Python - pythonHow to change the connection string for different jobs - c #Jquery hasClass element - jqueryMacro to split Word documents into one - vbaeventmachine and external scripts using backticks - windowsAll Articles