I have been working with the findAssocs()function from the tm package in R. If I am using the function with a single word I don't have any problems and I can manually input a multiple words I would like to find associations to in the following format:
findAssoc(corpusname,"cat","dog","elephant",.75,.75,.75)
Again no problem with manually inputting the multiple terms. I am trying to find the associations to lists of terms sometimes that might contact 30 or 40 words. I would like to us either a list or vector with findAssocs() instead of having to type out each word every time. Any ideas how to do this? I tried making a custom function but I still so new to R I did not have any luck. Thanks.
Thanks for the help. R has a pretty steep learning curve for a newbie. I tried the first method that you suggested and get an the error "Error: is.character(terms) is not TRUE" The code that I am using is:
#data for associates list
wordAssocList<- read.csv("Word Assocs List.txt")
# change TRUE to FALSE if you have no column headings in the CSV
as.character(wordAssocList)
attributes(wordAssocList)
my_assocs <- findAssocs(tdm, wordAssocList, .01)
my_assocs
For the output I get the following:
as.character(wordAssocList) [1] "logical(0)" attributes(wordAssocList) $names [1] "ÿþp"
$class [1] "data.frame"
$row.names integer(0)
my_assocs <- findAssocs(tdm, wordAssocList, .01) Error: is.character(terms) is not TRUE