R Eclipse StatET - Creating wordcloud gets overlapped words - r

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.
e.g. 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

Related

Drawing a clinical study subjects flow chart directly in R within a Jupyter notebook

I'm using R (3.x) within Jupyter to perform some statistical analysis of a clinical study.
The flow of subjects is pretty complex and I would like to draw the Patient flow chart directly in my notebook. Like this one :
Why ?
To make sure the subjects count is consistent with the code, and not having to maintain sync between the R code and this figure.
I've tried DiagrammeR (won't install for some reason), RGrahpviz (too complex and doesn't meet the requirements).
A perfect solution might come from mermaid but I couldn't find a way to have it integrated with my Jupyter/R notebooks.
I'm not using a python Jupyter notebook but a R notebook.
You have mentioned that DiagrammeR won't install, but I would still provide one solution using DiagrammeR anyway--in case you have solved the installation issue. Suppose after you have made the graph using DimagrammeR and obtained a grViz object named myGraph. To display it under jupyter notebook, I use the following
require('DiagrammeR')
require('DiagrammeRsvg') #export grViz objects to svg
require('IRdisplay')
mySVG<-export_svg(myGraph)
display_svg(data=mySVG)

Saving sequence tree from GraphViz

I'm new to TraMineR and sequence analysis in general. I am working on a project related to retention and recruitment of educational leaders and finding TraMineR to be very useful. This may be a simple thing (and somewhat unimportant), but I cannot seem to figure out how to name or direct the sequence tree created by GraphViz within the TraMinR package. Right now, my code is:
wardTree=as.seqtree(wardCluster,seqdata=retain.seq,diss=retain.dst,ncluster=15)
seqtreedisplay(wardTree,type="d",border=NA,showdepth=TRUE)
It produces a great graphic, but with a random file name that I cannot relocate if I accidentally close the graphic.
My main goal is to be able to uniquely name and save these graphs and pull into an R Markdown for the full project. To this point, the only thing I cannot pull in is the seqtree graphic.
Well, guess I figured it out! I didn't realize that the order in which filename command mattered...so...what seems to work out beautifully is:
wardTree=as.seqtree(wardCluster,seqdata=retain.seq,diss=retain.dst,ncluster=15)
seqtreedisplay(wardTree,type="d",border=NA,showtree=TRUE,showdepth=TRUE,filename="retaintree.png",imageformat="png")
And to incorporate the file in the Markdown i use the command
```
![](C:\Users\myname\Desktop\retaintree.png)
```{r fig.width=8.5, fig.height=11}
Hope this helps someone else along the way!

Line by line analysis and plotting on multiple monitors during presentation

I am preparing a presentation on data analysis and I am provided with a 2-3 monitor and projector head-up. I would like to use one monitor(+projector) for code, one monitor(+projector) for console display and one monitor(+projector) for plots. Monitors are for me, projectors for the audience.
I would also like to run the code line-by-line (similar to the Ctr-Enter feature of RStudio); copy pasting code won't work. I want to use interactive graphics, analysis and plotting on-the-fly so any pre-done analysis won't work.
Is there any way to achieve this? Although Rstudio is a fantastic tool, a rather basic (and one might say easy) feature like panel detachment is not being developed although frequently requested. This would be probably the best solution to what I want.
UPDATE: Any OS (Win, Mac, Linux) will do.
You should be able to use the vanilla R GUI. Within that you have separate panels/windows for code, console, and plots (with as many plot windows as you want by calling a new device like quartz()). You can evaluate a line of code from the script using Cmd-Enter(mac) and Cntr-Enter (pc) plus the default settings highlight the line of interest. You could also use emacs in the same way, which I find much more powerful and fun.

Using Protovis with R

As question, I have satisfied with what R and ggplot2 can do for static graph, but what about interactive graphs? How combine R and Protovis to make the graphs?
There is somethings called rwebvis but seems it is no longer active.
Any suggestion? Thanks.
Well, first you need a web server. Ooh, R has one of those now. Then you need some way of generating output on the web from R code - ooh, R has one of those too:
http://jeffreybreen.wordpress.com/2011/04/25/4-lines-of-r-to-get-you-started-using-the-rook-web-server-interface/
So you can then write R server pages that return JSON-encoded data that you can feed to Protovis - or if you want to get right up to date, to D3, which is Protovis++ and made of win.
Iplots is a fairly useful package that allows interactive graphing ( by this I mean selection linking between graphs, color linking, etc). It has some limitations and is not really made for producing plots as much as exploring data trends.
Acinonyx also was recently updated which is supposed to be an updated version of iplots, but from what I can tell it still has some work to do.
Not familiar with protovis or rwebvis.
There is a package from google called googlevis that enables some interactivity. This produces plots that are embeddable online. If you like protovis, the same author has another library called D3.
For running R on a webserver, I have been experimenting with RApache, which enables you to link your R installation to an apache server.
If the interactivity does not to be online, RStudio have a package called manipulate which may also be of interest.

Creating interactive pplets from R Output

Currently, I generate results from statistical analyses (e.g., a three-dimensional plot) and then "manually" move it to processing - a graphics programming language) where I can (with some simple coding) export an interactive java applet (e.g., allow the person viewing the plot to move in, out, and around the data points). Can I keep this whole process within R? Specifically, I want to create an applet (doesn't have to be Java but would need to be web embeddable, interactive (so not a movie), and not require the user to work in R or have to download things) that can be passed on.
Thanks.
Not totally clear on your requirements: can you be sure that the user will have R installed (e.g. can you run a script on their desktops to install everything first)? Does it have to run over the web?
The animation package (http://cran.r-project.org/web/packages/animation/) isn't interactive, but it can create moving images.
The iplots package is useful, although it requires R: http://rosuda.org/iPlots/iplots.html
Similarly, rggobi is extremely useful for interactive graphics, but it also requires R. You can read more http://www.jstatsoft.org/v30/b07/paper and http://www.ggobi.org/rggobi/.
A last example is biplotgui: http://r-forge.r-project.org/projects/biplotgui/
I heard that there's a project in development to create Flash output from R, but I can't find anything about it.
Can I keep this whole process within R?
Check out GGobi:
GGobi is an open source visualization program for exploring high-dimensional data. It provides highly dynamic and interactive graphics such as tours, as well as familiar graphics such as the scatterplot, barchart and parallel coordinates plots. Plots are interactive and linked with brushing and identification.

Resources