Hi Jim,
Thank you for the reply. Is there a way out to use it with wordcloud package and built a comparative and commonality cloud. My usage: comparison.cloud(term.matrix,max.words=300) commonality.cloud(term.matrix,random.order=FALSE, rot.per=0) I am already doing a lot of preprocessing and the sentence is not limited to 1 or 2. Thanks, ShailajaFrom: Jim Lemon <drjimle...@gmail.com>Sent: Wed, 18 May 2016 03:52:15 To: shaila shailaja <shaila...@rediffmail.com>Cc: "r-help@r-project.org" <r-help@r-project.org>Subject: Re: [R] Placement of words in a word cloud as per its occurance.Hi Shailaja,If you just want a line of words, it's not too difficult if you havethe word frequencies:# take a common sentencesentence<-"The quick brown fox jumps over the lazy dog"words<-unlist(strsplit(sentence," "))# make up some word frequencieswordfreq<-c(10,1,2,2,3,4,10,6,5)library(plotrix)# scale the frequencies into a convenient rangewordcex<-rescale(wordfreq,c(0.5,2))x11(height=4)# a simple function to display a vector of words in different sizeswordline<-function(words,wordcex,space=0.005) {plotxy<-par("usr")x<-plotxy[1]y<-sum(plotxy[3:4])/2space<-diff(plotxy[1:2])*spacefor(i in 1:length(words)) { par(cex=wordcex[i]) text(x,y,words[i],adj=0) x<-x+strwidth(words[i! ])+space}}# get an empty plotplot(1:10,type="n",axes=FALSE,xlab="",ylab="")# display the wordswordline(words,wordcex)The function can be elaborated to fit the sentence into the availablespace, break it into lines, all that sort of thing.JimOn Tue, May 17, 2016 at 9:09 PM, shaila shailaja<shaila...@rediffmail.com> wrote:> Dear R help subscribers,>>>>> I am working on a word cloud where in I want the words to appear in the same order as in the sentence/text.>> I only know&nbsp;the random.order -&nbsp;which plots words in random order. If false, they will be plotted in decreasing frequency.>> &nbsp;>> Any help is most welcome.>> &nbsp;>> Regards>> Shailaja> [[alternative HTML version deleted]]>> ______________________________________________> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see> https://stat.ethz.ch/mailman/listinfo/r-help&g! t; PLEASE do read the posting guide http://www.R-project.org/posting-g uide.html> and provide commented, minimal, self-contained, reproducible code.______________________________________________r-h...@r-project.org mailing list -- To UNSUBSCRIBE and more, seehttps://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.