[R] Converting corpus into dataframe in r tm package

vikrant vikrant.shimpi at tcs.com
Thu Apr 3 11:17:50 CEST 2014


HI ,

I would like to do stemming operation on vector of words using tm package. I
am using R 2.8.1 and tm package for same. For doing any operations i tm
package the data first needs to be converted to corpus
and then use various commands in tm package. No problem is I am not able to
convert these processed corpus into a dataframe/ vector. I am using
following commands for the same.

library(tm)
docs <- c("mining","miners")
s = Corpus(VectorSource(docs))
b = tmMap(s, stemDoc)
inspect(b)

By inspect command I am able to view the desired output but cannot convert
it into dataframeor any other datastructure for further usage. Inspect
command produces following output :
A corpus with 2 text documents

The metadata consists of 2 tag-value pairs and a data frame
Available tags are:
  create_date creator 
Available variables in the data frame are:
  MetaID 

[[1]]
[1] mine

[[2]]
[1] miner

I need only results 'mine' , 'miner' in a vector. Please help



--
View this message in context: http://r.789695.n4.nabble.com/Converting-corpus-into-dataframe-in-r-tm-package-tp4688081.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list