简体   繁体   中英

R Eclipse StatET - Creating wordcloud gets overlapped words

I'm trying to create a wordcloud using R in Eclipse. I've been working with R for some weeks without any problem and I´ve created lots of different plots, but when creating the wordcloud, any kind of them and using different configurations, I always get the wordcloud with all the words overlapped.

I've followed different examples and I always get the words overlapped. For example, if I execute this code:

library(wordcloud)
library(tm)

wordcloud("May our children and our children's children to a
            thousand generations, continue to enjoy the benefits conferred
            upon us by a united country, and have cause yet to rejoice under
            those glorious institutions bequeathed us by Washington and his
            compeers.",colors=brewer.pal(6,"Dark2"),random.order=FALSE)

I get this result:

As you can see, all the words are overlapped and I don´t know what to do. I've search a lot on the Internet and I didn't get any clue.

The arguments within the wordcloud package includes:

" use.r.layout - if false, then c++ code is used for collision detection, otherwise R is used" -Documentation for Wordcloud package.

There may be some difficulty with Eclipse and the usage of R vs. C++. As I am unsure as to the default of Wordcloud try toggling the argument between TRUE and FALSE .

eg Wordcloud("Corpus",use.r.layout=TRUE,colors=brewer.pal(6,"Dark2"),random.order=FALSE)

I got this problem after adding the command

Sys.setlocale('LC_ALL','C') 

Disabling this directive made wordclouds work fine again. I am using Jupyter Notebook with R kernel

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM