Hi, I am a consultant in Quality Management. I am exploring the use of R with any GUI - R commander/Rkward for doing analytical work. Have installed R, R Commander and Rkward. I hope to learn by doing various exercises that I use for teaching analytical techniques to my clients. I would be posting the data on this mailing list, and the rkward mailing list wherever I get stuck. First such technique I am trying to explore is the use of boxplots. The data is pasted below: Season Transporter Distance Tonnage Time 1 1 500 1 17 1 1 500 2 22 1 1 1000 1 23 1 1 1000 2 29 1 1 1500 1 33 1 1 1500 2 38 1 2 500 1 19 1 2 500 2 26 1 2 1000 1 30 1 2 1000 2 35 1 2 1500 1 42 1 2 1500 2 42 2 1 500 1 18 2 1 500 2 24 2 1 1000 1 25 2 1 1000 2 26 2 1 1500 1 35 2 1 1500 2 38 2 2 500 1 21 2 2 500 2 24 2 2 1000 1 28 2 2 1000 2 37 2 2 1500 1 36 2 2 1500 2 44 In this exercise, I am trying to plot box plots of the variable "Time", the last column and separated by all the other variables- Season, Transporter, Distance and Tonnage. I expect the output in form of multiple box plots, arranged side by side so that I can compare the time performance for, say, season 1, transporter 2, Distance 500 and tonnage 2 with, say, season 2, transporter 1, Distance 500 and tonnage 2. The box plot command in R Commander (Grpahs->Boxplot...) has a button called "plot by groups" presumably to achieve what I am trying to do. However, on clicking I don't get any further output. What am I missing? (There is nothing equivalent to this button under Rkward) I tried to search the mailing list on box plot, but could not find anything relevant. I have also searched in manual and seen this type (or even more complex analysis) being done on terminal. However, I need to do it under (any) GUI. Any help is highly appreciated. Thanks Vikas Garud
something like this will get you going, assuming your data are in a dataframe
called ?qual?
# qual <- read.table(pipe("pbpaste"), header=T, sep='\t')
boxplot(formula=Time~Distance+Season, data=qual)
Followup question from me:
i can?t see why
boxplot(formula=Time, data=qual)
should return the error "can?t find Time? ?Time~" and ?~Time"
don?t help
Doesn?t that make the formula interface to boxplot broken for one-variable non
grouped plots?
Best, t
On 17 May 2011, at 12:31 PM, Vikas Garud wrote:
> Hi,
>
> I am a consultant in Quality Management. I am exploring the use of R
> with any GUI - R commander/Rkward for doing analytical work. Have
> installed R, R Commander and Rkward.
>
> I hope to learn by doing various exercises that I use for teaching
> analytical techniques to my clients. I would be posting the data on
> this mailing list, and the rkward mailing list wherever I get stuck.
>
> First such technique I am trying to explore is the use of boxplots.
> The data is pasted below:
> Season Transporter Distance Tonnage Time
> 1 1 500 1 17
> 1 1 500 2 22
> 1 1 1000 1 23
> 1 1 1000 2 29
> 1 1 1500 1 33
> 1 1 1500 2 38
> 1 2 500 1 19
> 1 2 500 2 26
> 1 2 1000 1 30
> 1 2 1000 2 35
> 1 2 1500 1 42
> 1 2 1500 2 42
> 2 1 500 1 18
> 2 1 500 2 24
> 2 1 1000 1 25
> 2 1 1000 2 26
> 2 1 1500 1 35
> 2 1 1500 2 38
> 2 2 500 1 21
> 2 2 500 2 24
> 2 2 1000 1 28
> 2 2 1000 2 37
> 2 2 1500 1 36
> 2 2 1500 2 44
>
> In this exercise, I am trying to plot box plots of the variable
> "Time", the last column and separated by all the other variables-
> Season, Transporter, Distance and Tonnage. I expect the output in
> form of multiple box plots, arranged side by side so that I can
> compare the time performance for, say, season 1, transporter 2,
> Distance 500 and tonnage 2 with, say, season 2, transporter 1,
> Distance 500 and tonnage 2. The box plot command in R Commander
> (Grpahs->Boxplot...) has a button called "plot by groups"
presumably
> to achieve what I am trying to do. However, on clicking I don't get
> any further output. What am I missing? (There is nothing equivalent
> to this button under Rkward)
>
> I tried to search the mailing list on box plot, but could not find
> anything relevant. I have also searched in manual and seen this type
> (or even more complex analysis) being done on terminal. However, I
> need to do it under (any) GUI. Any help is highly appreciated.
>
> Thanks
> Vikas Garud
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
--- Vikas Garud <information4vikas at gmail.com> schrieb am Di, 17.5.2011:> Von: Vikas Garud <information4vikas at gmail.com> > Betreff: [R] Box Plot under GUI (R Commander/RKward) > An: r-help at r-project.org > Datum: Dienstag, 17. Mai, 2011 11:31 Uhr > Hi, > > I tried to search the mailing list on box plot, but could > not find > anything relevant.? I have also searched in manual and > seen this type > (or even more complex analysis) being done on > terminal.? However, I > need to do it under (any) GUI.? Any help is highly > appreciated.Why do you need a GUI solution for this? The whole point of R is it beeing a script based environment. Only with the command line you are really flexible and able to perform whatever analysis you want to conduct. I would highly recommend you and your clients to get into the basics of command line programming in R which are not as complicated as they seem to be at the start. Otherwise I would stick to SPSS/Excel/Sigmaplot or browse for some R GUIs with some basics beeing implemented on a "click basis" like RStudio, Rkward or TinnR. All R GUI implementations are however limited to basic plotting/analysis routines and I fear you will get stuck pretty soon when relying on the GUI. Jannis
On Tue, May 17, 2011 at 2:15 PM, Jannis <bt_jannis at yahoo.de> wrote:> ?Otherwise I would stick to SPSS/Excel/Sigmaplot or browse for some R GUIs with some basics beeing implemented on a "click basis" like RStudio, Rkward or TinnR. All R GUI implementations are however limited to basic plotting/analysis routines and I fear you will get stuck pretty soon when relying on the GUI. >Also Deducer. Liviu
Hi:
I'm assuming this is a snippet of a much larger data set, because one
certainly would not use box plots on singleton observations. You have
four grouping variables in your example, so the best you could likely
do on one graphics page would be to, for example, plot time vs.
distance, 'dodged' by season, say, which would have to be distributed
over separate panels defined by combinations of transporter and
tonnage. This is certainly possible in lattice and ggplot2, with the
latter being a bit more direct for this particular problem. Here is a
reproducible example:
df <- data.frame(Season = factor(rep(c(1, 2), each = 120)),
Transporter = factor(rep(rep(c(1, 2), each = 60), 2)),
Tonnage = factor(rep(rep(c(1, 2), each = 30), 8)),
Distance = factor(rep(rep(c(500, 1000, 1500), each
= 10), 8)),
Time = rpois(240, 25))
library(ggplot2)
ggplot(df2, aes(x = Distance, y = Time, fill = Season)) +
geom_boxplot(position = 'dodge') +
facet_grid(Transporter ~ Tonnage)
You probably want more evocative labels for the factor variables to
make them interpretable, but that's the general idea. It is also
possible to customize the graph in several ways. To do this
interactively, you would likely need to use the Deducer package in
conjunction with rJava, as Liviu suggested. See the package web page
http://www.deducer.org/pmwiki/pmwiki.php?n=Main.DeducerManual
which shows you how to get started. The videos are very useful, too.
Its author, Ian Fellows, has kindly provided an 'all-in-one' installer
for R-2.13.0, rJava (+ its dependencies) and Deducer. I would
certainly go this route if you're not adept at installing R packages,
and would particularly recommend this service on Windows. Deducer has
a GUI like rkward and Rstudio, but it has a more user-friendly menu
system analogous to R Commander. It does, however, require Java, so
you (and your clients) need to have it installed on your systems.
HTH,
Dennis
On Tue, May 17, 2011 at 4:31 AM, Vikas Garud
<information4vikas at gmail.com> wrote:> Hi,
>
> I am a consultant in Quality Management. ?I am exploring the use of R
> with any GUI - R commander/Rkward for doing analytical work. ?Have
> installed R, R Commander and Rkward.
>
> I hope to learn by doing various exercises that I use for teaching
> analytical techniques to my clients. ?I would be posting the data on
> this mailing list, and the rkward mailing list wherever I get stuck.
>
> First such technique I am trying to explore is the use of boxplots.
> The data is pasted below:
> Season ?Transporter ? ? Distance ? ? ? ?Tonnage Time
> 1 ? ? ? 1 ? ? ? 500 ? ? 1 ? ? ? 17
> 1 ? ? ? 1 ? ? ? 500 ? ? 2 ? ? ? 22
> 1 ? ? ? 1 ? ? ? 1000 ? ?1 ? ? ? 23
> 1 ? ? ? 1 ? ? ? 1000 ? ?2 ? ? ? 29
> 1 ? ? ? 1 ? ? ? 1500 ? ?1 ? ? ? 33
> 1 ? ? ? 1 ? ? ? 1500 ? ?2 ? ? ? 38
> 1 ? ? ? 2 ? ? ? 500 ? ? 1 ? ? ? 19
> 1 ? ? ? 2 ? ? ? 500 ? ? 2 ? ? ? 26
> 1 ? ? ? 2 ? ? ? 1000 ? ?1 ? ? ? 30
> 1 ? ? ? 2 ? ? ? 1000 ? ?2 ? ? ? 35
> 1 ? ? ? 2 ? ? ? 1500 ? ?1 ? ? ? 42
> 1 ? ? ? 2 ? ? ? 1500 ? ?2 ? ? ? 42
> 2 ? ? ? 1 ? ? ? 500 ? ? 1 ? ? ? 18
> 2 ? ? ? 1 ? ? ? 500 ? ? 2 ? ? ? 24
> 2 ? ? ? 1 ? ? ? 1000 ? ?1 ? ? ? 25
> 2 ? ? ? 1 ? ? ? 1000 ? ?2 ? ? ? 26
> 2 ? ? ? 1 ? ? ? 1500 ? ?1 ? ? ? 35
> 2 ? ? ? 1 ? ? ? 1500 ? ?2 ? ? ? 38
> 2 ? ? ? 2 ? ? ? 500 ? ? 1 ? ? ? 21
> 2 ? ? ? 2 ? ? ? 500 ? ? 2 ? ? ? 24
> 2 ? ? ? 2 ? ? ? 1000 ? ?1 ? ? ? 28
> 2 ? ? ? 2 ? ? ? 1000 ? ?2 ? ? ? 37
> 2 ? ? ? 2 ? ? ? 1500 ? ?1 ? ? ? 36
> 2 ? ? ? 2 ? ? ? 1500 ? ?2 ? ? ? 44
>
> In this exercise, I am trying to plot box plots of the variable
> "Time", the last column and separated by all the other variables-
> Season, Transporter, Distance and Tonnage. ?I expect the output in
> form of multiple box plots, arranged side by side so that I can
> compare the time performance for, say, season 1, transporter 2,
> Distance 500 and tonnage 2 with, say, season 2, transporter 1,
> Distance 500 and tonnage 2. ?The box plot command in R Commander
> (Grpahs->Boxplot...) has a button called "plot by groups"
presumably
> to achieve what I am trying to do. ?However, on clicking I don't get
> any further output. ?What am I missing? ?(There is nothing equivalent
> to this button under Rkward)
>
> I tried to search the mailing list on box plot, but could not find
> anything relevant. ?I have also searched in manual and seen this type
> (or even more complex analysis) being done on terminal. ?However, I
> need to do it under (any) GUI. ?Any help is highly appreciated.
>
> Thanks
> Vikas Garud
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
>