#CITATION Rdatamining.com
#speech from 
#http://www.narendramodi.in/nation-is-very-proud-of-our-servicemen-who-make-sacrifices-for-the-nation-narendra-modi-at-rewari-5545

getwd()
## [1] "C:/Users/dell/Desktop/Teaching"
rm(list=ls())
gc()
##          used (Mb) gc trigger (Mb) max used (Mb)
## Ncells 293905  7.9     592000 15.9   350000  9.4
## Vcells 324480  2.5     786432  6.0   677529  5.2
sessionInfo()
## R version 3.2.2 (2015-08-14)
## Platform: i386-w64-mingw32/i386 (32-bit)
## Running under: Windows 7 (build 7601) Service Pack 1
## 
## locale:
## [1] LC_COLLATE=English_United States.1252 
## [2] LC_CTYPE=English_United States.1252   
## [3] LC_MONETARY=English_United States.1252
## [4] LC_NUMERIC=C                          
## [5] LC_TIME=English_United States.1252    
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## loaded via a namespace (and not attached):
## [1] magrittr_1.5  tools_3.2.2   htmltools_0.3 stringi_1.0-1 rmarkdown_0.7
## [6] knitr_1.10.5  stringr_1.0.0 digest_0.6.8  evaluate_0.7
memory.limit()
## [1] 1535
library(tm)
## Loading required package: NLP
library(wordcloud)
## Loading required package: RColorBrewer
getSources()
## [1] "DataframeSource" "DirSource"       "URISource"       "VectorSource"   
## [5] "XMLSource"       "ZipSource"
getReaders()
##  [1] "readDOC"                 "readPDF"                
##  [3] "readPlain"               "readRCV1"               
##  [5] "readRCV1asPlain"         "readReut21578XML"       
##  [7] "readReut21578XMLasPlain" "readTabular"            
##  [9] "readTagged"              "readXML"
txt2="C:/Users/dell/Desktop/test"
dir(txt2)
## [1] "modi1.txt"
#?Corpus
# Corpora are collections of documents 
# containing (natural language) text. 
# In packages which employ the infrastructure
# provided by package tm, 
# such corpora are represented via the 
# virtual S3 class Corpus:



b=Corpus(DirSource(txt2), 
         readerControl = list(language = "eng"))
b
## <<VCorpus>>
## Metadata:  corpus specific: 0, document level (indexed): 0
## Content:  documents: 1
inspect(b)
## <<VCorpus>>
## Metadata:  corpus specific: 0, document level (indexed): 0
## Content:  documents: 1
## 
## [[1]]
## <<PlainTextDocument>>
## Metadata:  7
## Content:  chars: 0
## Content:  chars: 0
## Content:  chars: 594
## Content:  chars: 760
## Content:  chars: 128
## Content:  chars: 663
## Content:  chars: 422
## Content:  chars: 128
## Content:  chars: 761
## Content:  chars: 251
## Content:  chars: 128
## Content:  chars: 578
## Content:  chars: 549
## Content:  chars: 625
## Content:  chars: 128
## Content:  chars: 623
## Content:  chars: 767
## Content:  chars: 294
b <- tm_map(b, tolower)
inspect(b)
## <<VCorpus>>
## Metadata:  corpus specific: 0, document level (indexed): 0
## Content:  documents: 1
## 
## [[1]]
##  [1]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
##  [2]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
##  [3] shri narendra modi delivered his first speech after being announced as the bjp’s prime ministerial candidate for the 2014 lok sabha elections at the ex-servicemen rally in rewari, haryana. shri modi spoke out against being selective on the issue of terror and called for fighting wars against poverty, lack of education and blind faith. he urged pakistan to embrace the path of peace and leave the path of bombs because it has not done any good to the people, especially the youth and the poor. “from the land of mahatma gandhi, let us give a message of peace to the world,” declared shri modi.                                                                                                                                                                             
##  [4] narendra modi ji shared that it is his honour to be present at this historic gathering of ex-servicemen and other well-wishers, where lakhs of people gathered to listen to shri modi. he said that he is feeling more special being here than he did when the bjp declared him as their pm candidate for 2014 elections. paying tributes to india’s brave soldiers shri modi remarked, “be it any battle, it is the soldiers who make sacrifices. one cannot imagine their courage, the courage that is there in this land.” shri modi added that the nation is very proud of its servicemen. he congratulated the scientists of india for the successful launch of agni v missile earlier today, saying that getting good news like this in the last decade has become extremely rare.       
##  [5] nation is very proud of our servicemen, who make sacrifices for the nation: narendra modi at rewari haryana, rally, army, rewari                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
##  [6] during his speech narendrabhai shared personal anecdotes of his desire to serve in the army but could not sit in the exam due to financial constraints and how he volunteered to give tea and snacks to soldiers during the 1965 india-pakistan war. he added that years later in 1995 the bjp gave him the responsibility of north indian states like haryana, punjab, himachal pradesh and jammu & kashmir, which is when he got to visit cantonments and meet officers. he opined that it is some divine indication that out of all this ex-serviceman rally became his first public meeting after the pm announcement, even though the public meeting was planned long before that.                                                                                                        
##  [7] paying more tributes to the army shri modi pointed, “the level of toughness with which our armed forces deal with enemy nations is same as the level of compassion and kindness with which they save lives during times of natural calamities.” he lauded the work of the armed forces in the wake of the uttarakhand floods and noted that nobody can forget the work done by the army in the aftermath of the 2001 kutch earthquake.                                                                                                                                                                                                                                                                                                                                                         
##  [8] nation is very proud of our servicemen, who make sacrifices for the nation: narendra modi at rewari haryana, rally, army, rewari                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
##  [9] the chief minister described the armed forces as epitomizing the true nature of secularism. he said, “votebank politics has reached new lows and society is being divided. i want to tell those who divide the nation in the name of secularism- to see real secularism, see the army. we can learn the true essence of secularism from our armed forces and i salute our armed forces for upholding the ‘aan’, ‘baan’ and ‘shaan’ of secularism.” he recalled that right from 1857 hindus and muslims fought shoulder to shoulder and this tradition still goes on in the army. however, he spoke against the decision to count the religious demographics of the army under the sachar committee report and lauded the army officials who stood their ground and did not let it happen.      
## [10] expressing concern at the reduced interest among youngsters to join the army, shri modi pointed that educated youngsters must get drawn towards the forces because the nature of war is changing where aspects like technology are becoming more important.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
## [11] nation is very proud of our servicemen, who make sacrifices for the nation: narendra modi at rewari haryana, rally, army, rewari                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
## [12] shri modi spoke about the ‘one rank one pension’ issue that has been a very important issue for the ex-servicemen community. he called for a white paper on the issue and said that if the nda government under shri atal bihari vajpayee would have returned to power in 2004, atal ji would have found a way to this. he also talked about welfare of disabled servicemen and creating opportunities for retired servicemen so that the nation can gain out of their skills and discipline. he gave the example of how he sought the assistance of ex-serviceman in gujarat to curb power theft.                                                                                                                                                                                             
## [13] stressing on the need to become self sufficient in defence production, narendra modi questioned the reason why such a skilled nation has to get defence equipment from outside. “delhi is not interested in army welfare, they are more bothered about the next tender,” avowed the chief minister. he spoke of a dream of india exporting arms to the world. shri modi recalled that becoming self sufficient in defence equipment production is beneficial because it frees us from being bound by the foreign policies of the nations that are selling arms to us.                                                                                                                                                                                                                          
## [14] taking on the ambivalent attitude of the centre and other members of the political class towards the issues affecting the armed forces shri modi remarked, “when we were praising the work of our soldiers in uttarakhand, pakistan was killing our soldiers. and see the misfortune, the defence minister said people dressed in pakistan army uniform came. imagine how our soldiers would feel. delhi remained unbothered. for them, such events keep happening. then a minister said people join the army so die…what can be worse? if one cannot cry for the soldiers and is stone hearted let it be but do not insult our soldiers please.”                                                                                                                                              
## [15] nation is very proud of our servicemen, who make sacrifices for the nation: narendra modi at rewari haryana, rally, army, rewari                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
## [16] narendra modi opined that the armed forces and their welfare is not a priority for the centre. he remarked that whenever he celebrates diwali, he does so with jawans on gujarat’s india-pakistan border. he also talked about the gujarat government’s decision to build a pipeline that carries drinking water for the jawans in kutch. shri modi also shared that the gujarat government has built a war memorial and has put it on the tourist map as well. shri modi remarked that reasons behind the issues around the crisis we are facing do not lie in the army but they lie in delhi, which is why answers must be sought from delhi.                                                                                                                                                
## [17] shri modi spoke about the inherent dangers that come with terrorism and noted that the nature of war has now changed. “more than wars we are being troubled by proxy wars like terrorism and maoism,” affirmed shri modi. he called for a strong and united voice against terror. shri modi recalled that when the world was discussing only the issue of who kashmir belongs to, it was shri atal bihari vajpayee who brought the attention of the world to the issue of terrorism. in a clear message to pakistan, shri modi stated that instead of guns and bombs, pakistan should attempt not to make their land a home for terror. “you may be anti-india by birth but your existence cannot be anti-india.” shri modi spoke against cross-border terror, saying it does not help anybody.
## [18] he talked about the close ties between gujarat and haryana. during his speech, shri modi urged the youngsters to take up voter registration in a big way and even urged farmers to contribute their agriculture implements in the building of the statue of unity, which is a tribute to sardar patel.
# tm_map
# Interface to apply transformation functions 
# (also denoted as mappings) to corpora.
# remove punctuation
b <- tm_map(b, removePunctuation)
inspect(b)
## <<VCorpus>>
## Metadata:  corpus specific: 0, document level (indexed): 0
## Content:  documents: 1
## 
## [[1]]
##  [1]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
##  [2]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
##  [3] shri narendra modi delivered his first speech after being announced as the bjp’s prime ministerial candidate for the 2014 lok sabha elections at the exservicemen rally in rewari haryana shri modi spoke out against being selective on the issue of terror and called for fighting wars against poverty lack of education and blind faith he urged pakistan to embrace the path of peace and leave the path of bombs because it has not done any good to the people especially the youth and the poor “from the land of mahatma gandhi let us give a message of peace to the world” declared shri modi                                                                                                                                                                        
##  [4] narendra modi ji shared that it is his honour to be present at this historic gathering of exservicemen and other wellwishers where lakhs of people gathered to listen to shri modi he said that he is feeling more special being here than he did when the bjp declared him as their pm candidate for 2014 elections paying tributes to india’s brave soldiers shri modi remarked “be it any battle it is the soldiers who make sacrifices one cannot imagine their courage the courage that is there in this land” shri modi added that the nation is very proud of its servicemen he congratulated the scientists of india for the successful launch of agni v missile earlier today saying that getting good news like this in the last decade has become extremely rare     
##  [5] nation is very proud of our servicemen who make sacrifices for the nation narendra modi at rewari haryana rally army rewari                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
##  [6] during his speech narendrabhai shared personal anecdotes of his desire to serve in the army but could not sit in the exam due to financial constraints and how he volunteered to give tea and snacks to soldiers during the 1965 indiapakistan war he added that years later in 1995 the bjp gave him the responsibility of north indian states like haryana punjab himachal pradesh and jammu  kashmir which is when he got to visit cantonments and meet officers he opined that it is some divine indication that out of all this exserviceman rally became his first public meeting after the pm announcement even though the public meeting was planned long before that                                                                                                   
##  [7] paying more tributes to the army shri modi pointed “the level of toughness with which our armed forces deal with enemy nations is same as the level of compassion and kindness with which they save lives during times of natural calamities” he lauded the work of the armed forces in the wake of the uttarakhand floods and noted that nobody can forget the work done by the army in the aftermath of the 2001 kutch earthquake                                                                                                                                                                                                                                                                                                                                             
##  [8] nation is very proud of our servicemen who make sacrifices for the nation narendra modi at rewari haryana rally army rewari                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
##  [9] the chief minister described the armed forces as epitomizing the true nature of secularism he said “votebank politics has reached new lows and society is being divided i want to tell those who divide the nation in the name of secularism to see real secularism see the army we can learn the true essence of secularism from our armed forces and i salute our armed forces for upholding the ‘aan’ ‘baan’ and ‘shaan’ of secularism” he recalled that right from 1857 hindus and muslims fought shoulder to shoulder and this tradition still goes on in the army however he spoke against the decision to count the religious demographics of the army under the sachar committee report and lauded the army officials who stood their ground and did not let it happen  
## [10] expressing concern at the reduced interest among youngsters to join the army shri modi pointed that educated youngsters must get drawn towards the forces because the nature of war is changing where aspects like technology are becoming more important                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
## [11] nation is very proud of our servicemen who make sacrifices for the nation narendra modi at rewari haryana rally army rewari                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
## [12] shri modi spoke about the ‘one rank one pension’ issue that has been a very important issue for the exservicemen community he called for a white paper on the issue and said that if the nda government under shri atal bihari vajpayee would have returned to power in 2004 atal ji would have found a way to this he also talked about welfare of disabled servicemen and creating opportunities for retired servicemen so that the nation can gain out of their skills and discipline he gave the example of how he sought the assistance of exserviceman in gujarat to curb power theft                                                                                                                                                                                     
## [13] stressing on the need to become self sufficient in defence production narendra modi questioned the reason why such a skilled nation has to get defence equipment from outside “delhi is not interested in army welfare they are more bothered about the next tender” avowed the chief minister he spoke of a dream of india exporting arms to the world shri modi recalled that becoming self sufficient in defence equipment production is beneficial because it frees us from being bound by the foreign policies of the nations that are selling arms to us                                                                                                                                                                                                                  
## [14] taking on the ambivalent attitude of the centre and other members of the political class towards the issues affecting the armed forces shri modi remarked “when we were praising the work of our soldiers in uttarakhand pakistan was killing our soldiers and see the misfortune the defence minister said people dressed in pakistan army uniform came imagine how our soldiers would feel delhi remained unbothered for them such events keep happening then a minister said people join the army so die…what can be worse if one cannot cry for the soldiers and is stone hearted let it be but do not insult our soldiers please”                                                                                                                                          
## [15] nation is very proud of our servicemen who make sacrifices for the nation narendra modi at rewari haryana rally army rewari                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
## [16] narendra modi opined that the armed forces and their welfare is not a priority for the centre he remarked that whenever he celebrates diwali he does so with jawans on gujarat’s indiapakistan border he also talked about the gujarat government’s decision to build a pipeline that carries drinking water for the jawans in kutch shri modi also shared that the gujarat government has built a war memorial and has put it on the tourist map as well shri modi remarked that reasons behind the issues around the crisis we are facing do not lie in the army but they lie in delhi which is why answers must be sought from delhi                                                                                                                                         
## [17] shri modi spoke about the inherent dangers that come with terrorism and noted that the nature of war has now changed “more than wars we are being troubled by proxy wars like terrorism and maoism” affirmed shri modi he called for a strong and united voice against terror shri modi recalled that when the world was discussing only the issue of who kashmir belongs to it was shri atal bihari vajpayee who brought the attention of the world to the issue of terrorism in a clear message to pakistan shri modi stated that instead of guns and bombs pakistan should attempt not to make their land a home for terror “you may be antiindia by birth but your existence cannot be antiindia” shri modi spoke against crossborder terror saying it does not help anybody
## [18] he talked about the close ties between gujarat and haryana during his speech shri modi urged the youngsters to take up voter registration in a big way and even urged farmers to contribute their agriculture implements in the building of the statue of unity which is a tribute to sardar patel
# remove numbers
b <- tm_map(b, removeNumbers)

# remove stopwords
myStopwords <- c(stopwords('english'), "shri","modi")
b <- tm_map(b, removeWords, myStopwords)

b <- tm_map(b, stemDocument)
#run and running and ran
b <- tm_map(b, PlainTextDocument)

myDtm <- TermDocumentMatrix(b, control = list(minWordLength = 1))

inspect(myDtm)
## <<TermDocumentMatrix (terms: 396, documents: 1)>>
## Non-/sparse entries: 396/0
## Sparsity           : 0%
## Maximal term length: 14
## Weighting          : term frequency (tf)
## 
##                 Docs
## Terms            character(0)
##   ‘aan’                     1
##   ‘baan’                    1
##   ‘one                      1
##   ‘shaan’                   1
##   “delhi                    1
##   “votebank                 1
##   added                     2
##   affecting                 1
##   affirmed                  1
##   aftermath                 1
##   agni                      1
##   agriculture               1
##   also                      3
##   ambivalent                1
##   among                     1
##   anecdotes                 1
##   announced                 1
##   announcement              1
##   answers                   1
##   antiindia                 1
##   antiindia”                1
##   anybodi                   1
##   armed                     7
##   arms                      2
##   army                     16
##   around                    1
##   aspects                   1
##   assistance                1
##   atal                      3
##   attempt                   1
##   attention                 1
##   attitude                  1
##   avowed                    1
##   battle                    1
##   became                    1
##   become                    2
##   becoming                  2
##   behind                    1
##   belongs                   1
##   beneficial                1
##   big                       1
##   bihari                    2
##   birth                     1
##   bjp                       2
##   bjp’s                     1
##   blind                     1
##   bombs                     2
##   border                    1
##   bothered                  1
##   bound                     1
##   brave                     1
##   brought                   1
##   build                     1
##   building                  1
##   built                     1
##   calamities”               1
##   called                    3
##   came                      1
##   can                       4
##   candidate                 2
##   cantonments               1
##   carries                   1
##   celebrates                1
##   centre                    2
##   changed                   1
##   changing                  1
##   chief                     2
##   class                     1
##   clear                     1
##   close                     1
##   come                      1
##   committee                 1
##   community                 1
##   compassion                1
##   concern                   1
##   congratulated             1
##   constraints               1
##   contribute                1
##   count                     1
##   courage                   2
##   creating                  1
##   crisis                    1
##   crossborder               1
##   cry                       1
##   curb                      1
##   dangers                   1
##   deal                      1
##   decade                    1
##   decision                  2
##   declared                  2
##   defence                   4
##   delhi                     3
##   delivered                 1
##   demographics              1
##   described                 1
##   desire                    1
##   die…                      1
##   disabled                  1
##   discipline                1
##   discussing                1
##   divide                    1
##   divided                   1
##   divine                    1
##   diwali                    1
##   done                      2
##   drawn                     1
##   dream                     1
##   dressed                   1
##   drinking                  1
##   due                       1
##   earlier                   1
##   earthquak                 1
##   educated                  1
##   education                 1
##   elections                 2
##   embrace                   1
##   enemy                     1
##   epitomizing               1
##   equipment                 2
##   especially                1
##   essence                   1
##   even                      2
##   events                    1
##   exam                      1
##   example                   1
##   existence                 1
##   exporting                 1
##   expressing                1
##   exserviceman              2
##   exservicemen              3
##   extremely                 1
##   facing                    1
##   faith                     1
##   farmers                   1
##   feel                      1
##   feeling                   1
##   fighting                  1
##   financial                 1
##   first                     2
##   floods                    1
##   forces                    8
##   foreign                   1
##   forget                    1
##   fought                    1
##   found                     1
##   frees                     1
##   gain                      1
##   gandhi                    1
##   gathered                  1
##   gathering                 1
##   gave                      2
##   get                       2
##   getting                   1
##   give                      2
##   goes                      1
##   good                      2
##   got                       1
##   government                2
##   government’s              1
##   ground                    1
##   gujarat                   4
##   gujarat’s                 1
##   guns                      1
##   happen                    1
##   happening                 1
##   haryana                   7
##   hearted                   1
##   help                      1
##   himachal                  1
##   hindus                    1
##   historic                  1
##   home                      1
##   honour                    1
##   however                   1
##   imagine                   2
##   implements                1
##   import                    1
##   important                 1
##   india                     2
##   india’s                   1
##   indian                    1
##   indiapakistan             2
##   indication                1
##   inherent                  1
##   instead                   1
##   insult                    1
##   interest                  1
##   interested                1
##   issue                     6
##   issues                    2
##   jammu                     1
##   jawans                    2
##   join                      2
##   kashmir                   2
##   keep                      1
##   killing                   1
##   kindness                  1
##   kutch                     2
##   lack                      1
##   lakhs                     1
##   land                      2
##   land”                     1
##   last                      1
##   later                     1
##   lauded                    2
##   launch                    1
##   learn                     1
##   leave                     1
##   let                       3
##   level                     2
##   lie                       2
##   like                      4
##   listen                    1
##   lives                     1
##   lok                       1
##   long                      1
##   lows                      1
##   mahatma                   1
##   make                      6
##   maoism”                   1
##   map                       1
##   may                       1
##   meet                      1
##   meeting                   2
##   members                   1
##   memorial                  1
##   message                   2
##   minister                  4
##   ministerial               1
##   misfortune                1
##   missile                   1
##   muslims                   1
##   must                      2
##   name                      1
##   narendra                  8
##   narendrabhai              1
##   nation                   12
##   nations                   2
##   natural                   1
##   nature                    3
##   nda                       1
##   need                      1
##   new                       1
##   news                      1
##   next                      1
##   nobody                    1
##   north                     1
##   noted                     2
##   now                       1
##   officers                  1
##   officials                 1
##   one                       3
##   opined                    2
##   opportunities             1
##   outside                   1
##   pakistan                  5
##   paper                     1
##   patel                     1
##   path                      2
##   paying                    2
##   peace                     2
##   pension’                  1
##   people                    4
##   personal                  1
##   pipeline                  1
##   planned                   1
##   please”                   1
##   pointed                   2
##   policies                  1
##   political                 1
##   politics                  1
##   poor                      1
##   poverty                   1
##   power                     2
##   pradesh                   1
##   praising                  1
##   present                   1
##   prime                     1
##   priority                  1
##   production                2
##   proud                     5
##   proxy                     1
##   public                    2
##   punjab                    1
##   put                       1
##   questioned                1
##   rally                     6
##   rank                      1
##   rar                       1
##   reached                   1
##   real                      1
##   reason                    1
##   reasons                   1
##   recalled                  3
##   reduced                   1
##   registration              1
##   religious                 1
##   remained                  1
##   remarked                  4
##   report                    1
##   responsibility            1
##   retired                   1
##   returned                  1
##   rewari                    9
##   right                     1
##   sabha                     1
##   sachar                    1
##   sacrifices                5
##   said                      5
##   salute                    1
##   sardar                    1
##   save                      1
##   saying                    2
##   scientists                1
##   secularism                4
##   secularism”               1
##   see                       3
##   selective                 1
##   self                      2
##   selling                   1
##   serve                     1
##   servicemen                7
##   shared                    3
##   shoulder                  2
##   sit                       1
##   skilled                   1
##   skills                    1
##   snacks                    1
##   society                   1
##   soldiers                  8
##   sought                    2
##   special                   1
##   speech                    3
##   spoke                     6
##   stated                    1
##   states                    1
##   statue                    1
##   still                     1
##   stone                     1
##   stood                     1
##   stressing                 1
##   strong                    1
##   successful                1
##   sufficient                2
##   take                      1
##   taking                    1
##   talked                    3
##   tea                       1
##   technology                1
##   tell                      1
##   tender”                   1
##   terror                    4
##   terrorism                 3
##   theft                     1
##   though                    1
##   ties                      1
##   times                     1
##   today                     1
##   toughness                 1
##   tourist                   1
##   towards                   2
##   tradition                 1
##   tribute                   1
##   tributes                  2
##   troubled                  1
##   true                      2
##   unbothered                1
##   uniform                   1
##   united                    1
##   unity                     1
##   upholding                 1
##   urged                     3
##   uttarakhand               2
##   vajpayee                  2
##   visit                     1
##   voice                     1
##   volunteered               1
##   voter                     1
##   wake                      1
##   want                      1
##   war                       4
##   wars                      3
##   water                     1
##   way                       2
##   welfare                   3
##   well                      1
##   wellwishers               1
##   whenever                  1
##   white                     1
##   work                      3
##   world                     3
##   world”                    1
##   worse                     1
##   years                     1
##   youngsters                3
##   youth                     1
findFreqTerms(myDtm, lowfreq=10)
## [1] "army"   "nation"
findAssocs(myDtm, 'armi', 0.3)
## $armi
## numeric(0)
m <- as.matrix(myDtm)

v <- sort(rowSums(m), decreasing=TRUE)
v
##           army         nation         rewari         forces       narendra 
##             16             12              9              8              8 
##       soldiers          armed        haryana     servicemen          issue 
##              8              7              7              7              6 
##           make          rally          spoke       pakistan          proud 
##              6              6              6              5              5 
##     sacrifices           said            can        defence        gujarat 
##              5              5              4              4              4 
##           like       minister         people       remarked     secularism 
##              4              4              4              4              4 
##         terror            war           also           atal         called 
##              4              4              3              3              3 
##          delhi   exservicemen            let         nature            one 
##              3              3              3              3              3 
##       recalled            see         shared         speech         talked 
##              3              3              3              3              3 
##      terrorism          urged           wars        welfare           work 
##              3              3              3              3              3 
##          world     youngsters          added           arms         become 
##              3              3              2              2              2 
##       becoming         bihari            bjp          bombs      candidate 
##              2              2              2              2              2 
##         centre          chief        courage       decision       declared 
##              2              2              2              2              2 
##           done      elections      equipment           even   exserviceman 
##              2              2              2              2              2 
##          first           gave            get           give           good 
##              2              2              2              2              2 
##     government        imagine          india  indiapakistan         issues 
##              2              2              2              2              2 
##         jawans           join        kashmir          kutch           land 
##              2              2              2              2              2 
##         lauded          level            lie        meeting        message 
##              2              2              2              2              2 
##           must        nations          noted         opined           path 
##              2              2              2              2              2 
##         paying          peace        pointed          power     production 
##              2              2              2              2              2 
##         public         saying           self       shoulder         sought 
##              2              2              2              2              2 
##     sufficient        towards       tributes           true    uttarakhand 
##              2              2              2              2              2 
##       vajpayee            way          ‘aan’         ‘baan’           ‘one 
##              2              2              1              1              1 
##        ‘shaan’         “delhi      “votebank      affecting       affirmed 
##              1              1              1              1              1 
##      aftermath           agni    agriculture     ambivalent          among 
##              1              1              1              1              1 
##      anecdotes      announced   announcement        answers      antiindia 
##              1              1              1              1              1 
##     antiindia”        anybodi         around        aspects     assistance 
##              1              1              1              1              1 
##        attempt      attention       attitude         avowed         battle 
##              1              1              1              1              1 
##         became         behind        belongs     beneficial            big 
##              1              1              1              1              1 
##          birth          bjp’s          blind         border       bothered 
##              1              1              1              1              1 
##          bound          brave        brought          build       building 
##              1              1              1              1              1 
##          built    calamities”           came    cantonments        carries 
##              1              1              1              1              1 
##     celebrates        changed       changing          class          clear 
##              1              1              1              1              1 
##          close           come      committee      community     compassion 
##              1              1              1              1              1 
##        concern  congratulated    constraints     contribute          count 
##              1              1              1              1              1 
##       creating         crisis    crossborder            cry           curb 
##              1              1              1              1              1 
##        dangers           deal         decade      delivered   demographics 
##              1              1              1              1              1 
##      described         desire           die…       disabled     discipline 
##              1              1              1              1              1 
##     discussing         divide        divided         divine         diwali 
##              1              1              1              1              1 
##          drawn          dream        dressed       drinking            due 
##              1              1              1              1              1 
##        earlier      earthquak       educated      education        embrace 
##              1              1              1              1              1 
##          enemy    epitomizing     especially        essence         events 
##              1              1              1              1              1 
##           exam        example      existence      exporting     expressing 
##              1              1              1              1              1 
##      extremely         facing          faith        farmers           feel 
##              1              1              1              1              1 
##        feeling       fighting      financial         floods        foreign 
##              1              1              1              1              1 
##         forget         fought          found          frees           gain 
##              1              1              1              1              1 
##         gandhi       gathered      gathering        getting           goes 
##              1              1              1              1              1 
##            got   government’s         ground      gujarat’s           guns 
##              1              1              1              1              1 
##         happen      happening        hearted           help       himachal 
##              1              1              1              1              1 
##         hindus       historic           home         honour        however 
##              1              1              1              1              1 
##     implements         import      important        india’s         indian 
##              1              1              1              1              1 
##     indication       inherent        instead         insult       interest 
##              1              1              1              1              1 
##     interested          jammu           keep        killing       kindness 
##              1              1              1              1              1 
##           lack          lakhs          land”           last          later 
##              1              1              1              1              1 
##         launch          learn          leave         listen          lives 
##              1              1              1              1              1 
##            lok           long           lows        mahatma        maoism” 
##              1              1              1              1              1 
##            map            may           meet        members       memorial 
##              1              1              1              1              1 
##    ministerial     misfortune        missile        muslims           name 
##              1              1              1              1              1 
##   narendrabhai        natural            nda           need            new 
##              1              1              1              1              1 
##           news           next         nobody          north            now 
##              1              1              1              1              1 
##       officers      officials  opportunities        outside          paper 
##              1              1              1              1              1 
##          patel       pension’       personal       pipeline        planned 
##              1              1              1              1              1 
##        please”       policies      political       politics           poor 
##              1              1              1              1              1 
##        poverty        pradesh       praising        present          prime 
##              1              1              1              1              1 
##       priority          proxy         punjab            put     questioned 
##              1              1              1              1              1 
##           rank            rar        reached           real         reason 
##              1              1              1              1              1 
##        reasons        reduced   registration      religious       remained 
##              1              1              1              1              1 
##         report responsibility        retired       returned          right 
##              1              1              1              1              1 
##          sabha         sachar         salute         sardar           save 
##              1              1              1              1              1 
##     scientists    secularism”      selective        selling          serve 
##              1              1              1              1              1 
##            sit        skilled         skills         snacks        society 
##              1              1              1              1              1 
##        special         stated         states         statue          still 
##              1              1              1              1              1 
##          stone          stood      stressing         strong     successful 
##              1              1              1              1              1 
##           take         taking            tea     technology           tell 
##              1              1              1              1              1 
##        tender”          theft         though           ties          times 
##              1              1              1              1              1 
##          today      toughness        tourist      tradition        tribute 
##              1              1              1              1              1 
##       troubled     unbothered        uniform         united          unity 
##              1              1              1              1              1 
##      upholding          visit          voice    volunteered          voter 
##              1              1              1              1              1 
##           wake           want          water           well    wellwishers 
##              1              1              1              1              1 
##       whenever          white         world”          worse          years 
##              1              1              1              1              1 
##          youth 
##              1
myNames <- names(v)

d <- data.frame(word=myNames, freq=v)

wordcloud(d$word, d$freq, min.freq=3,col=brewer.pal(5,"Spectral"))