0 2 3 4 0 4 0 5
0 3 2 0 4 1 3 0
3 1 5 1 1 3 5 0
2 3 2 0 0 5 3 9
0 0 0 1 0 0 2 0
0 0 0 2 0 0 1 0
0 0 0 1 0 0 1 0

library(tm) #load text mining library
setwd('C:\\Users\\abdul.razzaq.UL\\Downloads\\TraceLab-master\\jEdit4.3\\DS\\queries') #sets R's working directory to near where my files are
a  <-Corpus(DirSource("C:\\Users\\abdul.razzaq.UL\\Downloads\\TraceLab-master\\jEdit4.3\\DS\\queries"), readerControl = list(language="lat")) #specifies the exact folder where my text file(s) is for analysis with tm.
a <- tm_map(a , stripWhitespace)
a <- tm_map(a, tolower)
#a <- tm_map(a, removePunctuation)
a <- tm_map(a, stemDocument, language = "english")
a <- tm_map(a, removeWords, stopwords("english")) 
adtm <-DocumentTermMatrix(a) 
#as.matrix(adtm)
write.csv(as.matrix(adtm), file="qmatrix.csv")
