How to use “R Graph Builder” and “R Graphics” view

2019-02-20 03:46发布

问题:

I am new to R and want to use the Eclipse plugin StatEt with Oxygen.2 Release (4.7.2) on Windows 7.

I tried to create an example plot with the R Graph Builder. I click the "play button" and get following output on the R Code tab. Furthermore, I hear a "ping" sound.

library(ggplot2)

p <- ggplot(data = mtcars, aes(x = mpg, y = cyl))
p <- p + labs(title = "test")

print(p)

However, I can not see any graph.

=> Is the purpose of the "play action" only to produce the console output?

=> Where can I find documentation about the Graph Builder?

=> What data can I enter to get a first example graph?

Furthermore, when I plot a graph in StatEt, I would expect its output to be in the view "R Graphics". However, a new window is opened by R. I have the option "Set R Graphic view by StatET as default graphic device for new plots in R" enabled on the tab "R Console" in my console run configuration.

=> What is the purpose of the "R Graphics" view?

Example plots:

x<-c(1:10)
y<-sin(x)       
plot(x=x,y=y)

-

library(ggplot2)
ggplot(data = mtcars,aes(x=wt))+geom_bar()

Related questions:

  • How does one install 'rj' in StatET plugin for Eclipse?

  • ClassNotFoundException for StatEt Eclipse plugin / RJ. Compatibility issue with Java9?

  • Why doesn't my ecplise console start with StatET

  • How to index R library for Help view of StatEt Eclipse plugin?

回答1:

  • In order to use those features of StatEt you need to select RJ (default) instead of Rterm in the Console run configuration. (Rterm might be useful for trouble shooting and initial setup but RJ is required for normal usage. The R package RJ needs to be installed from within R. Apply Rterm once for doing so or use R.exe directly. Also see ClassNotFoundException for StatEt Eclipse plugin / RJ. Compatibility issue with Java9?)

  • RJ 2.1 is not compatible to Java 9. Currently you need to install Java8 and select it in the JRE settings of the run configuration.

  • Make sure that the box Set R Graphic view by StatET as default graphic device for new plots in R is checked in Run configuration>R console. (It is checked by default.)

Once you have created your graph, the example code is written in code. This is normally sent to the R console. You should now be able to see the graphical result in the R Graphics view.