Re: [R] boxplot of raster and shapefile

2024-08-28 Thread Ben Tupper
405556 +lon_0=7.439583
> +k_0=1 +x_0=260 +y_0=120 +ellps=bessel +units=m +no_defs
>
> source : Andrena.barbilabris_glo_ensemble.tif
>
> names  : Andrena.barbilabris_glo_ensemble
>
> values : 0, 53  (min, max)
>
>
>
> > str(r)
>
> Formal class 'RasterLayer' [package "raster"] with 13 slots
>
>   ..@ file:Formal class '.RasterFile' [package "raster"] with 13 slots
>
>   .. .. ..@ name: chr "C:\\Users\\...\\Andren"| __truncated__
>
>   .. .. ..@ datanotation: chr "INT2U"
>
>   .. .. ..@ byteorder   : chr "little"
>
>   .. .. ..@ nodatavalue : num -Inf
>
>   .. .. ..@ NAchanged   : logi FALSE
>
>   .. .. ..@ nbands  : int 1
>
>   .. .. ..@ bandorder   : chr "BIL"
>
>   .. .. ..@ offset  : int 0
>
>   .. .. ..@ toptobottom : logi TRUE
>
>   .. .. ..@ blockrows   : Named int 1
>
>   .. .. .. ..- attr(*, "names")= chr "rows"
>
>   .. .. ..@ blockcols   : Named int 14400
>
>   .. .. .. ..- attr(*, "names")= chr "cols"
>
>   .. .. ..@ driver  : chr "gdal"
>
>   .. .. ..@ open: logi FALSE
>
>   ..@ data:Formal class '.SingleLayerData' [package "raster"] with 13
> slots
>
>   .. .. ..@ values: logi(0)
>
>   .. .. ..@ offset: num 0
>
>   .. .. ..@ gain  : num 1
>
>   .. .. ..@ inmemory  : logi FALSE
>
>   .. .. ..@ fromdisk  : logi TRUE
>
>   .. .. ..@ isfactor  : logi FALSE
>
>   .. .. ..@ attributes: list()
>
>   .. .. ..@ haveminmax: logi TRUE
>
>   .. .. ..@ min   : num 0
>
>   .. .. ..@ max   : num 53
>
>   .. .. ..@ band  : int 1
>
>   .. .. ..@ unit  : chr ""
>
>   .. .. ..@ names : chr "Andrena.barbilabris_glo_ensemble"
>
>   ..@ legend  :Formal class '.RasterLegend' [package "raster"] with 5 slots
>
>   .. .. ..@ type  : chr(0)
>
>   .. .. ..@ values: logi(0)
>
>   .. .. ..@ color : logi(0)
>
>   .. .. ..@ names : logi(0)
>
>   .. .. ..@ colortable: logi(0)
>
>   ..@ title   : chr(0)
>
>   ..@ extent  :Formal class 'Extent' [package "raster"] with 4 slots
>
>   .. .. ..@ xmin: num 248
>
>   .. .. ..@ xmax: num 284
>
>   .. .. ..@ ymin: num 107
>
>   .. .. ..@ ymax: num 130
>
>   ..@ rotated : logi FALSE
>
>   ..@ rotation:Formal class '.Rotation' [package "raster"] with 2 slots
>
>   .. .. ..@ geotrans: num(0)
>
>   .. .. ..@ transfun:function ()
>
>   ..@ ncols   : int 14400
>
>   ..@ nrows   : int 9200
>
>   ..@ crs :Formal class 'CRS' [package "sp"] with 1 slot
>
>   .. .. ..@ projargs: chr "+proj=somerc +lat_0=46.952405556
> +lon_0=7.439583 +k_0=1 +x_0=260 +y_0=120 +ellps=bessel
> +units=m +no_defs"
>
>   .. .. ..$ comment: chr "PROJCRS[\"unknown\",\n
> BASEGEOGCRS[\"unknown\",\nDATUM[\"Unknown based on Bessel 1841
> ellipsoid\",\n"| __truncated__
>
>   ..@ srs : chr "+proj=somerc +lat_0=46.952405556
> +lon_0=7.439583 +k_0=1 +x_0=260 +y_0=120 +ellps=bessel
> +units=m +no_defs"
>
>   ..@ history : list()
>
>   ..@ z   : list()
>
>
>
>
>
> > e <- extract(r,v)
>
> Error in (function (classes, fdef, mtable)  :
>
>   kann keine vererbte Methode finden für Funktion ‘extract’ für Signatur
> ‘"RasterLayer", "SpatVector"’
>
>
>
>
>
> Kind regards
>
> Sibylle
>
>
>
> -Original Message-
> From: Ivan Krylov 
> Sent: Tuesday, August 27, 2024 6:55 PM
> To: SIBYLLE STÖCKLI via R-help 
> Cc: sibylle.stoec...@gmx.ch
> Subject: Re: [R] boxplot of raster and shapefile
>
>
>
> В Mon, 26 Aug 2024 14:33:02 +0200
>
> SIBYLLE STÖCKLI via R-help < <mailto:r-help@r-project.org>
> r-help@r-project.org> пишет:
>
>
>
> > > # Extract raster values within the shapefile extracted_values <-
>
> > > extract(raster_file, shape_file)
>
>
>
> > > # Assuming the shapefile has multiple polygons and you want to #
>
> > > create a boxplot for each data_list <-
>
> > > lapply(1:length(extracted_values), function(i) {
>
> > + data.frame(value = extracted_values[[i]], polygon = i)
>
> > + })
>
> > > data <- do.call(rbind, data_list)
>
>
>
> > > names(data)
>
> > [1] "value"   "polygon"
>
> > > # Create the boxplot
>
> > > bp<-ggplot(data, aes(x = factor(polygon), y = value)) +
>
> > + geom_boxplot() +
>
> > + labs(x = "Polygon", y = "Raster Values") +
>
> > + theme_minimal()
>
> > > bp
>
> > Error in UseMethod("depth") :
>
> >   no applicable method for 'depth' applied to an object of class
>
> > "NULL"
>
> > In addition: Warning message:
>
> > Removed 452451 rows containing non-finite outside the scale range
>
> > (`stat_boxplot()`).
>
>
>
> Thank you for providing a runnable example! Could you please also show
>
> the output of str(extracted_values) and str(data)?
>
>
>
> --
>
> Best regards,
>
> Ivan
>
>
> [[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
> https://www.R-project.org/posting-guide.html
> and 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 https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] boxplot of raster and shapefile

2024-08-28 Thread SIBYLLE STÖCKLI via R-help
max   : num 53

  .. .. ..@ band  : int 1

  .. .. ..@ unit  : chr ""

  .. .. ..@ names : chr "Andrena.barbilabris_glo_ensemble"

  ..@ legend  :Formal class '.RasterLegend' [package "raster"] with 5 slots

  .. .. ..@ type  : chr(0) 

  .. .. ..@ values: logi(0) 

  .. .. ..@ color : logi(0) 

  .. .. ..@ names : logi(0) 

  .. .. ..@ colortable: logi(0) 

  ..@ title   : chr(0) 

  ..@ extent  :Formal class 'Extent' [package "raster"] with 4 slots

  .. .. ..@ xmin: num 248

  .. .. ..@ xmax: num 284

  .. .. ..@ ymin: num 107

  .. .. ..@ ymax: num 130

  ..@ rotated : logi FALSE

  ..@ rotation:Formal class '.Rotation' [package "raster"] with 2 slots

  .. .. ..@ geotrans: num(0) 

  .. .. ..@ transfun:function ()  

  ..@ ncols   : int 14400

  ..@ nrows   : int 9200

  ..@ crs :Formal class 'CRS' [package "sp"] with 1 slot

  .. .. ..@ projargs: chr "+proj=somerc +lat_0=46.952405556 
+lon_0=7.439583 +k_0=1 +x_0=260 +y_0=120 +ellps=bessel +units=m 
+no_defs"

  .. .. ..$ comment: chr "PROJCRS[\"unknown\",\nBASEGEOGCRS[\"unknown\",\n  
  DATUM[\"Unknown based on Bessel 1841 ellipsoid\",\n"| __truncated__

  ..@ srs : chr "+proj=somerc +lat_0=46.952405556 
+lon_0=7.439583 +k_0=1 +x_0=260 +y_0=120 +ellps=bessel +units=m 
+no_defs"

  ..@ history : list()

  ..@ z   : list()

 

 

> e <- extract(r,v)

Error in (function (classes, fdef, mtable)  : 

  kann keine vererbte Methode finden für Funktion ‘extract’ für Signatur 
‘"RasterLayer", "SpatVector"’

 

 

Kind regards

Sibylle

 

-Original Message-
From: Ivan Krylov  
Sent: Tuesday, August 27, 2024 6:55 PM
To: SIBYLLE STÖCKLI via R-help 
Cc: sibylle.stoec...@gmx.ch
Subject: Re: [R] boxplot of raster and shapefile

 

В Mon, 26 Aug 2024 14:33:02 +0200

SIBYLLE STÖCKLI via R-help < <mailto:r-help@r-project.org> 
r-help@r-project.org> пишет:

 

> > # Extract raster values within the shapefile extracted_values <- 

> > extract(raster_file, shape_file)

 

> > # Assuming the shapefile has multiple polygons and you want to # 

> > create a boxplot for each data_list <- 

> > lapply(1:length(extracted_values), function(i) {

> + data.frame(value = extracted_values[[i]], polygon = i)

> + })

> > data <- do.call(rbind, data_list)

 

> > names(data)

> [1] "value"   "polygon"

> > # Create the boxplot

> > bp<-ggplot(data, aes(x = factor(polygon), y = value)) +  

> + geom_boxplot() +

> + labs(x = "Polygon", y = "Raster Values") +

> + theme_minimal()

> > bp  

> Error in UseMethod("depth") : 

>   no applicable method for 'depth' applied to an object of class

> "NULL"

> In addition: Warning message:

> Removed 452451 rows containing non-finite outside the scale range

> (`stat_boxplot()`). 

 

Thank you for providing a runnable example! Could you please also show

the output of str(extracted_values) and str(data)?

 

-- 

Best regards,

Ivan


[[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 https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] boxplot of raster and shapefile

2024-08-27 Thread Ivan Krylov via R-help
В Mon, 26 Aug 2024 14:33:02 +0200
SIBYLLE STÖCKLI via R-help  пишет:

> > # Extract raster values within the shapefile
> > extracted_values <- extract(raster_file, shape_file)

> > # Assuming the shapefile has multiple polygons and you want to
> > # create a boxplot for each
> > data_list <- lapply(1:length(extracted_values), function(i) {  
> + data.frame(value = extracted_values[[i]], polygon = i)
> + })
> > data <- do.call(rbind, data_list)  

> > names(data)  
> [1] "value"   "polygon"
 
> > # Create the boxplot
> > bp<-ggplot(data, aes(x = factor(polygon), y = value)) +  
> + geom_boxplot() +
> + labs(x = "Polygon", y = "Raster Values") +
> + theme_minimal()
> > bp  
> Error in UseMethod("depth") : 
>   no applicable method for 'depth' applied to an object of class
> "NULL"
> In addition: Warning message:
> Removed 452451 rows containing non-finite outside the scale range
> (`stat_boxplot()`). 

Thank you for providing a runnable example! Could you please also show
the output of str(extracted_values) and str(data)?

-- 
Best regards,
Ivan

__
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 https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] boxplot notch

2024-08-16 Thread CALUM POLWART
Unless I'm missing the point, you are sending the summary data MS1s to the
plot.  Is that not a VERY unusual way to do it. Let box plot do the
summary? Otherwise what do you want the notches to show?

On Fri, 16 Aug 2024, 17:21 Chris Evans via R-help, 
wrote:

> That's not really a reprex Sibylle.  I did try to use it to see if I
> could work out what you were trying to do and help but there is so much
> in there that I suspect is distraction from the notch issue and its
> error message.
>
> Please can you give us something stripped of all unecessary things and
> tell us what you want?
>
> Something like data that we can read as a tribble() or from a dput() of
> your data and then only the packages you actually need for the plot (I
> think tidyverse alone might do) and then a ggplot() call stripped right
> down to what you need and a clear explanation of what you are trying to
> do in the geom_boxplot() call and how it uses the summarised data tibble.
>
> It may even be that if you do that, you will find what's causing the
> problem!  (I speak from bitter experience!!)
>
> Very best (all),
>
> Chris
>
> On 16/08/2024 17:51, SIBYLLE STÖCKLI via R-help wrote:
> > Farm_ID   JahrBio QI_A
> > 1 20151   9.5
> > 2 20181   15.7
> > 3 20201   21.5
> > 1 20151   50.5
> > 2 20181   12.9
> > 3 20201   11.2
> > 1 20151   30.6
> > 2 20181   28.7
> > 3 20201   29.8
> > 1 20151   30.1
> > 2 20181   NA
> > 3 20201   16.9
> > 1 20150   6.5
> > 2 20180   7.9
> > 3 20200   10.2
> > 1 20150   11.2
> > 2 20180   18.5
> > 3 20200   29.5
> > 1 20150   25.1
> > 2 20180   16.1
> > 3 20200   15.9
> > 1 20150   10.1
> > 2 20180   8.4
> > 3 20200   3.5
> > 1 20150   NA
> > 2 20180   NA
> > 3 20200   3.5
> >
> >
> > Code
> > setwd("C:/Users/Sibylle Stöckli/Desktop/")
> > #.libPaths()
> > getwd()
> >
> > #libraries laden
> > library("ggplot2")
> > library("gridExtra")
> > library(scales)
> > library(nlme)
> > library(arm)
> > library(blmeco)
> > library(stats)
> > library(dplyr)
> > library(ggpubr)
> > library(patchwork)
> > library(plotrix)
> > library(tidyverse)
> > library(dplyr)
> >
> > #read data
> > MS = read.delim("Test1.txt", na.strings="NA")
> > names(MS)
> >
> > MS$Jahr<-as.numeric(MS$Jahr)
> > MS$Bio<-as.factor(MS$Bio)
> > str(MS)
> >
> > # boxplot BFF QI
> >
> > MS1<- MS %>% filter(QI_A!="NA") %>% droplevels()
> > MS1$Jahr<-as.factor(MS1$Jahr)
> >
> > MS1s <- MS1 %>%
> >group_by(MS1$Jahr, MS1$Bio) %>%
> >summarise(
> >  y0 = quantile(QI_A, 0.05),
> >  y25 = quantile(QI_A, 0.25),
> >  y50 = mean(QI_A),
> >  y75 = quantile(QI_A, 0.75),
> >  y100 = quantile(QI_A, 0.95))
> >
> > MS1s
> > colnames(MS1s)[1]<-"Jahr"
> > colnames(MS1s)[2]<-"Bio"
> > MS1s
> >
> > p1<-ggplot(MS1s, aes(Jahr,  fill = as.factor(Bio))) +
> >geom_boxplot(
> >  aes(ymin = y0, lower = y25, middle = y50, upper = y75, ymax = y100),
> >  stat = "identity", notch=TRUE
> >) +
> >theme(panel.background = element_blank())+
> >theme(axis.line = element_line(colour = "black"))+
> >theme(axis.text=element_text(size=18))+
> >theme(axis.title=element_text(size=20))+
> >ylab("Anteil BFF an LN [%]") +xlab("Jahr")+
> >scale_color_manual(values=c("red","darkgreen"), labels=c("ÖLN",
> "BIO"))+
> >scale_fill_manual(values=c("red","darkgreen"), labels= c("ÖLN",
> "BIO"))+
> >theme(legend.title = element_blank())+
> >theme(legend.text=element_text(size=20))
> > p1<-p1 + expand_limits(y=c(0, 80))
> > p1
> --
> Chris Evans (he/him)
> Visiting Professor, UDLA, Quito, Ecuador & Honorary Professor,
> University of Roehampton, London, UK.
> Work web site: https://www.psyctc.org/psyctc/
> CORE site: http://www.coresystemtrust.org.uk/
> Personal site: https://www.psyctc.org/pelerinage2016/
> Emeetings (Thursdays):
> https://www.psyctc.org/psyctc/booking-meetings-with-me/
> (Beware: French time, generally an hour ahead of UK)
> 
> [[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
> https://www.R-project.org/posting-guide.html
> and 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 https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] boxplot notch

2024-08-16 Thread Chris Evans via R-help
That's not really a reprex Sibylle.  I did try to use it to see if I 
could work out what you were trying to do and help but there is so much 
in there that I suspect is distraction from the notch issue and its 
error message.

Please can you give us something stripped of all unecessary things and 
tell us what you want?

Something like data that we can read as a tribble() or from a dput() of 
your data and then only the packages you actually need for the plot (I 
think tidyverse alone might do) and then a ggplot() call stripped right 
down to what you need and a clear explanation of what you are trying to 
do in the geom_boxplot() call and how it uses the summarised data tibble.

It may even be that if you do that, you will find what's causing the 
problem!  (I speak from bitter experience!!)

Very best (all),

Chris

On 16/08/2024 17:51, SIBYLLE STÖCKLI via R-help wrote:
> Farm_ID   JahrBio QI_A
> 1 20151   9.5
> 2 20181   15.7
> 3 20201   21.5
> 1 20151   50.5
> 2 20181   12.9
> 3 20201   11.2
> 1 20151   30.6
> 2 20181   28.7
> 3 20201   29.8
> 1 20151   30.1
> 2 20181   NA
> 3 20201   16.9
> 1 20150   6.5
> 2 20180   7.9
> 3 20200   10.2
> 1 20150   11.2
> 2 20180   18.5
> 3 20200   29.5
> 1 20150   25.1
> 2 20180   16.1
> 3 20200   15.9
> 1 20150   10.1
> 2 20180   8.4
> 3 20200   3.5
> 1 20150   NA
> 2 20180   NA
> 3 20200   3.5
>
>
> Code
> setwd("C:/Users/Sibylle Stöckli/Desktop/")
> #.libPaths()
> getwd()
>
> #libraries laden
> library("ggplot2")
> library("gridExtra")
> library(scales)
> library(nlme)
> library(arm)
> library(blmeco)
> library(stats)
> library(dplyr)
> library(ggpubr)
> library(patchwork)
> library(plotrix)
> library(tidyverse)
> library(dplyr)
>
> #read data
> MS = read.delim("Test1.txt", na.strings="NA")
> names(MS)
>
> MS$Jahr<-as.numeric(MS$Jahr)
> MS$Bio<-as.factor(MS$Bio)
> str(MS)
>
> # boxplot BFF QI
>
> MS1<- MS %>% filter(QI_A!="NA") %>% droplevels()
> MS1$Jahr<-as.factor(MS1$Jahr)
>
> MS1s <- MS1 %>%
>group_by(MS1$Jahr, MS1$Bio) %>%
>summarise(
>  y0 = quantile(QI_A, 0.05),
>  y25 = quantile(QI_A, 0.25),
>  y50 = mean(QI_A),
>  y75 = quantile(QI_A, 0.75),
>  y100 = quantile(QI_A, 0.95))
>
> MS1s
> colnames(MS1s)[1]<-"Jahr"
> colnames(MS1s)[2]<-"Bio"
> MS1s
>
> p1<-ggplot(MS1s, aes(Jahr,  fill = as.factor(Bio))) +
>geom_boxplot(
>  aes(ymin = y0, lower = y25, middle = y50, upper = y75, ymax = y100),
>  stat = "identity", notch=TRUE
>) +
>theme(panel.background = element_blank())+
>theme(axis.line = element_line(colour = "black"))+
>theme(axis.text=element_text(size=18))+
>theme(axis.title=element_text(size=20))+
>ylab("Anteil BFF an LN [%]") +xlab("Jahr")+
>scale_color_manual(values=c("red","darkgreen"), labels=c("ÖLN", "BIO"))+
>scale_fill_manual(values=c("red","darkgreen"), labels= c("ÖLN", "BIO"))+
>theme(legend.title = element_blank())+
>theme(legend.text=element_text(size=20))
> p1<-p1 + expand_limits(y=c(0, 80))
> p1
-- 
Chris Evans (he/him)
Visiting Professor, UDLA, Quito, Ecuador & Honorary Professor, 
University of Roehampton, London, UK.
Work web site: https://www.psyctc.org/psyctc/
CORE site: http://www.coresystemtrust.org.uk/
Personal site: https://www.psyctc.org/pelerinage2016/
Emeetings (Thursdays): 
https://www.psyctc.org/psyctc/booking-meetings-with-me/
(Beware: French time, generally an hour ahead of UK)

[[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 https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] boxplot notch

2024-08-16 Thread Bert Gunter
Probably should be:
rep("yes", length.out = len)[ypos]

as yes is probably a nonexistent variable.

But I didn't examine your code in detail, so just ignore if I'm wrong.

-- Bert

On Fri, Aug 16, 2024 at 8:51 AM SIBYLLE STÖCKLI via R-help
 wrote:
>
> Thanks Ben,
>
> Here the reproducible example.
> It works without notch=TRUE, but provides an error with notch=TURE
>
> Error in `geom_boxplot()`:
> ! Problem while converting geom to grob.
> ℹ Error occurred in the 1st layer.
> Caused by error in `ans[ypos] <- rep(yes, length.out = len)[ypos]`:
> ! replacement has length zero
> Run `rlang::last_trace()` to see where the error occurred.
> Warning message:
> In rep(yes, length.out = len) : 'x' is NULL so the result will be NULL
>
>
> Data
> Farm_ID JahrBio QI_A
> 1   20151   9.5
> 2   20181   15.7
> 3   20201   21.5
> 1   20151   50.5
> 2   20181   12.9
> 3   20201   11.2
> 1   20151   30.6
> 2   20181   28.7
> 3   20201   29.8
> 1   20151   30.1
> 2   20181   NA
> 3   20201   16.9
> 1   20150   6.5
> 2   20180   7.9
> 3   20200   10.2
> 1   20150   11.2
> 2   20180   18.5
> 3   20200   29.5
> 1   20150   25.1
> 2   20180   16.1
> 3   20200   15.9
> 1   20150   10.1
> 2   20180   8.4
> 3   20200   3.5
> 1   20150   NA
> 2   20180   NA
> 3   20200   3.5
>
>
> Code
> setwd("C:/Users/Sibylle Stöckli/Desktop/")
> #.libPaths()
> getwd()
>
> #libraries laden
> library("ggplot2")
> library("gridExtra")
> library(scales)
> library(nlme)
> library(arm)
> library(blmeco)
> library(stats)
> library(dplyr)
> library(ggpubr)
> library(patchwork)
> library(plotrix)
> library(tidyverse)
> library(dplyr)
>
> #read data
> MS = read.delim("Test1.txt", na.strings="NA")
> names(MS)
>
> MS$Jahr<-as.numeric(MS$Jahr)
> MS$Bio<-as.factor(MS$Bio)
> str(MS)
>
> # boxplot BFF QI
>
> MS1<- MS %>% filter(QI_A!="NA") %>% droplevels()
> MS1$Jahr<-as.factor(MS1$Jahr)
>
> MS1s <- MS1 %>%
>   group_by(MS1$Jahr, MS1$Bio) %>%
>   summarise(
> y0 = quantile(QI_A, 0.05),
> y25 = quantile(QI_A, 0.25),
> y50 = mean(QI_A),
> y75 = quantile(QI_A, 0.75),
> y100 = quantile(QI_A, 0.95))
>
> MS1s
> colnames(MS1s)[1]<-"Jahr"
> colnames(MS1s)[2]<-"Bio"
> MS1s
>
> p1<-ggplot(MS1s, aes(Jahr,  fill = as.factor(Bio))) +
>   geom_boxplot(
> aes(ymin = y0, lower = y25, middle = y50, upper = y75, ymax = y100),
> stat = "identity", notch=TRUE
>   ) +
>   theme(panel.background = element_blank())+
>   theme(axis.line = element_line(colour = "black"))+
>   theme(axis.text=element_text(size=18))+
>   theme(axis.title=element_text(size=20))+
>   ylab("Anteil BFF an LN [%]") +xlab("Jahr")+
>   scale_color_manual(values=c("red","darkgreen"), labels=c("ÖLN", "BIO"))+
>   scale_fill_manual(values=c("red","darkgreen"), labels= c("ÖLN", "BIO"))+
>   theme(legend.title = element_blank())+
>   theme(legend.text=element_text(size=20))
> p1<-p1 + expand_limits(y=c(0, 80))
> p1
>
> -Original Message-
> From: R-help  On Behalf Of Ben Bolker
> Sent: Friday, August 16, 2024 3:30 PM
> To: r-help@r-project.org
> Subject: Re: [R] boxplot notch
>
>I don't see anything obviously wrong here. There may be something subtle, 
> but we probably won't be able to help without a reproducible example ...
>
> On 2024-08-16 9:24 a.m., SIBYLLE STÖCKLI via R-help wrote:
> > Dear community
> >
> >
> >
> > I tried the following code using geom_boxplot() and notch=TRUE. Does
> > anyone know if the command  notch=TRUE  is at the wrong place in my
> > special code construct?
> >
> >
> >
> > Without notch=TRUE the code provides the planned ggplot.
> >
> >
> >
> > Kind regards
> >
> > Sibylle
> >
> >
> >
> > Code:
> >
> >
> >
> > MS1<- MS %>% filter(QI_A!="NA") %>% droplevels()
> >
> > MS1$Jahr<-as.factor(MS1$Jahr)
> >
> >
> >
> > MS1s <- MS1 %>%
> >
> >group_by(MS1$Jahr, MS

Re: [R] boxplot notch

2024-08-16 Thread SIBYLLE STÖCKLI via R-help
Thanks Ben,

Here the reproducible example.
It works without notch=TRUE, but provides an error with notch=TURE

Error in `geom_boxplot()`:
! Problem while converting geom to grob.
ℹ Error occurred in the 1st layer.
Caused by error in `ans[ypos] <- rep(yes, length.out = len)[ypos]`:
! replacement has length zero
Run `rlang::last_trace()` to see where the error occurred.
Warning message:
In rep(yes, length.out = len) : 'x' is NULL so the result will be NULL


Data
Farm_ID JahrBio QI_A
1   20151   9.5
2   20181   15.7
3   20201   21.5
1   20151   50.5
2   20181   12.9
3   20201   11.2
1   20151   30.6
2   20181   28.7
3   20201   29.8
1   20151   30.1
2   20181   NA
3   20201   16.9
1   20150   6.5
2   20180   7.9
3   20200   10.2
1   20150   11.2
2   20180   18.5
3   20200   29.5
1   20150   25.1
2   20180   16.1
3   20200   15.9
1   20150   10.1
2   20180   8.4
3   20200   3.5
1   20150   NA
2   20180   NA
3   20200   3.5


Code
setwd("C:/Users/Sibylle Stöckli/Desktop/")
#.libPaths()
getwd()  

#libraries laden
library("ggplot2")
library("gridExtra")  
library(scales)
library(nlme)
library(arm)
library(blmeco)
library(stats)  
library(dplyr)
library(ggpubr)
library(patchwork)
library(plotrix)
library(tidyverse)
library(dplyr)

#read data
MS = read.delim("Test1.txt", na.strings="NA")
names(MS)

MS$Jahr<-as.numeric(MS$Jahr)
MS$Bio<-as.factor(MS$Bio)
str(MS)

# boxplot BFF QI

MS1<- MS %>% filter(QI_A!="NA") %>% droplevels()
MS1$Jahr<-as.factor(MS1$Jahr)

MS1s <- MS1 %>%
  group_by(MS1$Jahr, MS1$Bio) %>%
  summarise(
y0 = quantile(QI_A, 0.05),
y25 = quantile(QI_A, 0.25),
y50 = mean(QI_A),
y75 = quantile(QI_A, 0.75),
y100 = quantile(QI_A, 0.95))

MS1s
colnames(MS1s)[1]<-"Jahr"
colnames(MS1s)[2]<-"Bio"
MS1s

p1<-ggplot(MS1s, aes(Jahr,  fill = as.factor(Bio))) +
  geom_boxplot(
aes(ymin = y0, lower = y25, middle = y50, upper = y75, ymax = y100),
stat = "identity", notch=TRUE
  ) +
  theme(panel.background = element_blank())+
  theme(axis.line = element_line(colour = "black"))+
  theme(axis.text=element_text(size=18))+
  theme(axis.title=element_text(size=20))+
  ylab("Anteil BFF an LN [%]") +xlab("Jahr")+
  scale_color_manual(values=c("red","darkgreen"), labels=c("ÖLN", "BIO"))+
  scale_fill_manual(values=c("red","darkgreen"), labels= c("ÖLN", "BIO"))+
  theme(legend.title = element_blank())+
  theme(legend.text=element_text(size=20))
p1<-p1 + expand_limits(y=c(0, 80))
p1

-Original Message-
From: R-help  On Behalf Of Ben Bolker
Sent: Friday, August 16, 2024 3:30 PM
To: r-help@r-project.org
Subject: Re: [R] boxplot notch

   I don't see anything obviously wrong here. There may be something subtle, 
but we probably won't be able to help without a reproducible example ...

On 2024-08-16 9:24 a.m., SIBYLLE STÖCKLI via R-help wrote:
> Dear community
> 
>   
> 
> I tried the following code using geom_boxplot() and notch=TRUE. Does 
> anyone know if the command  notch=TRUE  is at the wrong place in my 
> special code construct?
> 
>   
> 
> Without notch=TRUE the code provides the planned ggplot.
> 
>   
> 
> Kind regards
> 
> Sibylle
> 
>   
> 
> Code:
> 
>   
> 
> MS1<- MS %>% filter(QI_A!="NA") %>% droplevels()
> 
> MS1$Jahr<-as.factor(MS1$Jahr)
> 
>   
> 
> MS1s <- MS1 %>%
> 
>group_by(MS1$Jahr, MS1$Bio) %>%
> 
>summarise(
> 
>  y0 = quantile(QI_A, 0.05),
> 
>  y25 = quantile(QI_A, 0.25),
> 
>  y50 = mean(QI_A),
> 
>  y75 = quantile(QI_A, 0.75),
> 
>  y100 = quantile(QI_A, 0.95))
> 
>   
> 
> MS1s
> 
> colnames(MS1s)[1]<-"Jahr"
> 
> colnames(MS1s)[2]<-"Bio"
> 
> MS1s
> 
>   
> 
> p1<-ggplot(MS1s, aes(Jahr,  fill = as.factor(Bio))) +
> 
>geom_boxplot(
> 
>  aes(ymin = y0, lower = y25, middle = y50, upper = y75, ymax = 
> y100),
> 
>  stat = "identity", notch=TRUE
> 
>) +
> 
>theme(panel.background = element_blank())+
> 
>theme(axis.line = element_line(colour = "black"))+
> 
>theme(axis.text=element_text(size=18))+
> 
>theme(axis.title=element_text(size=20))+
> 
>ylab("Anteil BFF an LN [%]") +xlab("J

Re: [R] boxplot notch

2024-08-16 Thread Ben Bolker
  I don't see anything obviously wrong here. There may be something 
subtle, but we probably won't be able to help without a reproducible 
example ...


On 2024-08-16 9:24 a.m., SIBYLLE STÖCKLI via R-help wrote:

Dear community

  


I tried the following code using geom_boxplot() and notch=TRUE. Does anyone
know if the command �notch=TRUE� is at the wrong place in my special code
construct?

  


Without notch=TRUE the code provides the planned ggplot.

  


Kind regards

Sibylle

  


Code:

  


MS1<- MS %>% filter(QI_A!="NA") %>% droplevels()

MS1$Jahr<-as.factor(MS1$Jahr)

  


MS1s <- MS1 %>%

   group_by(MS1$Jahr, MS1$Bio) %>%

   summarise(

 y0 = quantile(QI_A, 0.05),

 y25 = quantile(QI_A, 0.25),

 y50 = mean(QI_A),

 y75 = quantile(QI_A, 0.75),

 y100 = quantile(QI_A, 0.95))

  


MS1s

colnames(MS1s)[1]<-"Jahr"

colnames(MS1s)[2]<-"Bio"

MS1s

  


p1<-ggplot(MS1s, aes(Jahr,  fill = as.factor(Bio))) +

   geom_boxplot(

 aes(ymin = y0, lower = y25, middle = y50, upper = y75, ymax = y100),

 stat = "identity", notch=TRUE

   ) +

   theme(panel.background = element_blank())+

   theme(axis.line = element_line(colour = "black"))+

   theme(axis.text=element_text(size=18))+

   theme(axis.title=element_text(size=20))+

   ylab("Anteil BFF an LN [%]") +xlab("Jahr")+

   scale_color_manual(values=c("red","darkgreen"), labels=c("�LN", "BIO"))+

   scale_fill_manual(values=c("red","darkgreen"), labels= c("�LN", "BIO"))+

   theme(legend.title = element_blank())+

   theme(legend.text=element_text(size=20))

p1<-p1 + expand_limits(y=c(0, 80))

p1


[[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.


--
Dr. Benjamin Bolker
Professor, Mathematics & Statistics and Biology, McMaster University
Director, School of Computational Science and Engineering
> E-mail is sent at my convenience; I don't expect replies outside of 
working hours.


__
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.


Re: [R] Boxplot with linear (not categorical) x-axis

2018-09-30 Thread Luigi Marongiu
Thank you.
On Fri, Sep 28, 2018 at 5:34 PM William Dunlap  wrote:
>
> Use the 'at' argument to boxplot.  E.g.,
>
> > x <- rep(c(2,4,8,16), c(5,10,20,30))
> > y <- seq_along(x)
> > par(mfrow=c(2,1))
> > boxplot(y~x, at=unique(x))
> > boxplot(y~x)
>
>
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
>
> On Fri, Sep 28, 2018 at 3:05 AM, Luigi Marongiu  
> wrote:
>>
>> Dear all,
>> I am using boxplot to draw some data. Would be possible to have the
>> X-axis linear (as in a scatter plot) instead of the standard
>> categorical axis?
>> The data I have is subdivided into three groups at the numerical
>> values 1, 3, 5; boxplot treats these as categorical values; in fact, I
>> can write my own labels simply by using the values 1, 2, 3 for the
>> position of the labels as in the example.
>> Thank you,
>>
>> 
>> # generate data.frames
>> A = c(70, 22, 4, 21, 29, 35, 24, 20, 9, 21,
>>   22, 12, 20, 21, 13, 18, 15, 3, 9, 23,
>>   6, 5, 2, 24, 25, 21, 16, 0, 4, 1)
>> B = c(17, 21, 70, 6, 23, 10, 8, 5, 22, 5,
>>   21, 5, 19, 9, 23, 24, 11, 13, 7, 15,
>>   25, 9, 13, 14, 11, 9, 12, 0, 5, 9)
>> C = c(17, 8, 30, 22, 11, 32, 33, 8, 160, 11,
>>   35, 7, 36, 15, 11, 25, 16, 6, 38, 19,
>>   35, 30, 12, 27, 22, 32, 47, 39, 31, 26)
>> X = rep(c(1, 3, 5),30*3)
>> dfA <- data.frame(X, c(A, B, C))
>> names(dfA) <- c("X", "Y")
>> par(mfrow=c(2,1))
>> boxplot(dfA$Y ~ dfA$X,
>> ylim=c(0, 80),
>> col="green",
>> ylab="Y-values",
>> xlab="X-values",
>> main="usual X labels"
>> )
>> boxplot(dfA$Y ~ dfA$X,
>> ylim=c(0, 80),
>> col="green",
>> ylab="Y-values",
>> xlab="X-values",
>> main="custom X labels",
>> xaxt="n"
>> )
>> x.lab = c("A", "B", "C")
>> x.pos = c(1, 2, 3)
>> axis(side=1, at=x.pos,
>>  lab=x.lab, cex.axis=1)
>>
>> --
>> Best regards,
>> Luigi
>>
>> __
>> 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.
>
>


-- 
Best regards,
Luigi

__
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.


Re: [R] Boxplot with linear (not categorical) x-axis

2018-09-28 Thread William Dunlap via R-help
Use the 'at' argument to boxplot.  E.g.,

> x <- rep(c(2,4,8,16), c(5,10,20,30))
> y <- seq_along(x)
> par(mfrow=c(2,1))
> boxplot(y~x, at=unique(x))
> boxplot(y~x)


Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Fri, Sep 28, 2018 at 3:05 AM, Luigi Marongiu 
wrote:

> Dear all,
> I am using boxplot to draw some data. Would be possible to have the
> X-axis linear (as in a scatter plot) instead of the standard
> categorical axis?
> The data I have is subdivided into three groups at the numerical
> values 1, 3, 5; boxplot treats these as categorical values; in fact, I
> can write my own labels simply by using the values 1, 2, 3 for the
> position of the labels as in the example.
> Thank you,
>
> 
> # generate data.frames
> A = c(70, 22, 4, 21, 29, 35, 24, 20, 9, 21,
>   22, 12, 20, 21, 13, 18, 15, 3, 9, 23,
>   6, 5, 2, 24, 25, 21, 16, 0, 4, 1)
> B = c(17, 21, 70, 6, 23, 10, 8, 5, 22, 5,
>   21, 5, 19, 9, 23, 24, 11, 13, 7, 15,
>   25, 9, 13, 14, 11, 9, 12, 0, 5, 9)
> C = c(17, 8, 30, 22, 11, 32, 33, 8, 160, 11,
>   35, 7, 36, 15, 11, 25, 16, 6, 38, 19,
>   35, 30, 12, 27, 22, 32, 47, 39, 31, 26)
> X = rep(c(1, 3, 5),30*3)
> dfA <- data.frame(X, c(A, B, C))
> names(dfA) <- c("X", "Y")
> par(mfrow=c(2,1))
> boxplot(dfA$Y ~ dfA$X,
> ylim=c(0, 80),
> col="green",
> ylab="Y-values",
> xlab="X-values",
> main="usual X labels"
> )
> boxplot(dfA$Y ~ dfA$X,
> ylim=c(0, 80),
> col="green",
> ylab="Y-values",
> xlab="X-values",
> main="custom X labels",
> xaxt="n"
> )
> x.lab = c("A", "B", "C")
> x.pos = c(1, 2, 3)
> axis(side=1, at=x.pos,
>  lab=x.lab, cex.axis=1)
>
> --
> Best regards,
> Luigi
>
> __
> 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.
>

[[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.


Re: [R] Boxplot with linear (not categorical) x-axis

2018-09-28 Thread Richard M. Heiberger
install.packages("HH")
library(HH)
system.file("demo/bwplot.examples.r", package="HH")
demo("bwplot.examples", package="HH", ask=FALSE)

## your example
dfA <- data.frame(X, Y=c(A, B, C))
dfA$X.factor <- factor(dfA$X)
position(dfA$X.factor) <- c(1,3,5)
bwplot(Y ~ X.factor, panel=panel.bwplot.intermediate.hh, data=dfA, xlim=c(0,6))

On Fri, Sep 28, 2018 at 6:05 AM, Luigi Marongiu
 wrote:
> Dear all,
> I am using boxplot to draw some data. Would be possible to have the
> X-axis linear (as in a scatter plot) instead of the standard
> categorical axis?
> The data I have is subdivided into three groups at the numerical
> values 1, 3, 5; boxplot treats these as categorical values; in fact, I
> can write my own labels simply by using the values 1, 2, 3 for the
> position of the labels as in the example.
> Thank you,
>
>
> # generate data.frames
> A = c(70, 22, 4, 21, 29, 35, 24, 20, 9, 21,
>   22, 12, 20, 21, 13, 18, 15, 3, 9, 23,
>   6, 5, 2, 24, 25, 21, 16, 0, 4, 1)
> B = c(17, 21, 70, 6, 23, 10, 8, 5, 22, 5,
>   21, 5, 19, 9, 23, 24, 11, 13, 7, 15,
>   25, 9, 13, 14, 11, 9, 12, 0, 5, 9)
> C = c(17, 8, 30, 22, 11, 32, 33, 8, 160, 11,
>   35, 7, 36, 15, 11, 25, 16, 6, 38, 19,
>   35, 30, 12, 27, 22, 32, 47, 39, 31, 26)
> X = rep(c(1, 3, 5),30*3)
> dfA <- data.frame(X, c(A, B, C))
> names(dfA) <- c("X", "Y")
> par(mfrow=c(2,1))
> boxplot(dfA$Y ~ dfA$X,
> ylim=c(0, 80),
> col="green",
> ylab="Y-values",
> xlab="X-values",
> main="usual X labels"
> )
> boxplot(dfA$Y ~ dfA$X,
> ylim=c(0, 80),
> col="green",
> ylab="Y-values",
> xlab="X-values",
> main="custom X labels",
> xaxt="n"
> )
> x.lab = c("A", "B", "C")
> x.pos = c(1, 2, 3)
> axis(side=1, at=x.pos,
>  lab=x.lab, cex.axis=1)
>
> --
> Best regards,
> Luigi
>
> __
> 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.

__
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.


Re: [R] Boxplot: draw outliers in colours

2018-09-28 Thread Jim Lemon
Hi Luigi,
An easy way is to use "points" to overplot the outliers:

grbxp<-boxplot(dfA$Y ~ dfA$X,
 ylim=c(0, 200),
 col="green",
 ylab="Y-values",
 xlab="X-values"
 )
points(grbxp$group,grbxp$out,col="green")


On Fri, Sep 28, 2018 at 7:51 PM Luigi Marongiu  wrote:
>
> Dear all,
> I am trying to overlap two series of boxplots on the same graph. In
> order to distinguish the outliers from one series to the other, would
> be possible to colour the outliers?: instead of the standard black, is
> it possible to give a chosen colour?
> Thank you
>
> >>>
> This is the example. I could not generate not normally distributed
> random values (even with runif), so I had to create the values
> manually and they are still a bit rough (in the real thing, the two
> series are more distant), anyway this should better explain the case.
> Note that the three outliers at the bottom right belong to the 'blue'
> distribution and the upper outlier on the right belongs to the 'green'
> distribution, so making them in blue and green colours would make
> clearer their positions.
>
> # generate data.frames
> A = c(70, 22, 4, 21, 29, 35, 24, 20, 9, 21,
>   22, 12, 20, 21, 13, 18, 15, 3, 9, 23,
>   6, 5, 2, 24, 25, 21, 16, 0, 4, 1)
> B = c(17, 21, 70, 6, 23, 10, 8, 5, 22, 5,
>   21, 5, 19, 9, 23, 24, 11, 13, 7, 15,
>   25, 9, 13, 14, 11, 9, 12, 0, 5, 9)
> C = c(17, 8, 30, 22, 11, 32, 33, 8, 160, 11,
>   35, 7, 36, 15, 11, 25, 16, 6, 38, 19,
>   35, 30, 12, 27, 22, 32, 47, 39, 31, 26)
> D = c(79, 26, 8, 33, 59, 67, 60, 65, 54, 88,
>   78, 105, 59, 40, 109, 81, 28, 26, 94,
>   35, 10, 38, 58, 79, 58, 10, 5, 8, 4, 50)
> E = c(98, 104, 101, 102, 97, 97, 97,
>   100, 97, 102, 100, 103, 104,
>   104, 99, 102, 100, 97, 102, 105,
>   99, 105, 100, 102, 100, 115,
>   112, 113, 111, 115)
> G = c(105, 130, 97, 105, 113, 123,
>   149, 15, 134, 148, 98, 104,
>   113, 108, 209, 145, 138, 119,
>   142, 129, 298, 101, 136, 129,
>   148, 295, 125, 277, 107, 642)
> X = rep(c(1, 3, 5),30*3)
> dfA <- data.frame(X, c(A, B, C))
> dfB <- data.frame(X, c(D, E, G))
> names(dfA) <- c("X", "Y")
> names(dfB) <- c("X", "Y")
>
> # plot
> boxplot(dfA$Y ~ dfA$X,
> ylim=c(0, 200),
> col="green",
> ylab="Y-values",
> xlab="X-values"
> )
> par(new=TRUE)
> boxplot(dfB$Y ~ dfB$X,
> ylim=c(0, 200),
> col="blue",
> ylab="", xlab="",
> xaxt="n", yaxt="n"
> )
>
>
> --
> Best regards,
> Luigi
>
> __
> 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.

__
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.


Re: [R] BoxPlot Adding Mean and Median Values

2018-05-10 Thread S Ellison
> Here is the code I have tried.
The code has to work to be useful.
including the data read - which, because it is on your D: drive, clearly can't 
be read..

But here are some comments and some base graphics code that should get you 
started;

> As I mentioned below, would like to add the data labels into each box of mean
> value
#You'll need to calculate the mean values separately. A standard 
boxplot doesn't include them

> AmbientTr <- read.csv("AmbientBatchbox.csv", stringsAsFactors = TRUE)
#Not possible

> str(AmbientTr)
> summary(AmbientTr)
#Not possible
> install.packages("ggplot2")
#Don;t need to do this every time
> library(ggplot2)
#And you don’t need it at all: you are using 'boxplot', which is in 
base graphics

> boxplot(RTF~Batch,data=AmbientTr, ylim = c(0,30), main="RTF By Batch",
> xlab="Batch", ylab="RTF", col ="blue")
#Try assigning the result of boxplot to a variable, such as
bw.data <-  boxplot(RTF~Batch,data=AmbientTr, ylim = c(0,30), main="RTF By 
Batch",
 xlab="Batch", ylab="RTF", col ="blue")

#Then you csan use that data to place labels etc. because boxplot returns the 
stats for the boxes, and the locations 
#are (by default) at 1:length()bw.data$names.

#For example, after the above plot:
with(bw.data, text(1:length(names), stats[3,], names, pos=1) #labels just below 
the medians

#And for placing means on the plot:
RTFmeans <- with(AmbientTr, tapply(RTF, batch, mean))
points(1:length(RTFmeans), RTFmeans, pch=19)
text(1:length(RTFmeans), RTFmeans, paste(round(RTFmeans,0)), pos=3) #labels 
just above the points 

#... or something like that. 

For a ggplot equivalent, you could try the ggplot mailing list; Google it to 
find it.

S Ellison


***
This email and any attachments are confidential. Any use, copying or
disclosure other than by the intended recipient is unauthorised. If 
you have received this message in error, please notify the sender 
immediately via +44(0)20 8943 7000 or notify postmas...@lgcgroup.com 
and delete this message and any copies from your computer and network. 
LGC Limited. Registered in England 2991879. 
Registered office: Queens Road, Teddington, Middlesex, TW11 0LY, UK
__
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.


Re: [R] BoxPlot Adding Mean and Median Values

2018-05-09 Thread Jayaganesh Anbuganapathy

Hello Dave

Here is the code I have tried.

getwd()
setwd("D:/BAP Session/Nuance")
getwd()
AmbientTr <- read.csv("AmbientBatchbox.csv", stringsAsFactors = TRUE)

str(AmbientTr)
summary(AmbientTr)

install.packages("ggplot2")
library(ggplot2)

boxplot(RTF~Batch,data=AmbientTr, ylim = c(0,30), main="RTF By Batch", 
xlab="Batch", ylab="RTF", col ="blue")


As I mentioned below, would like to add the data labels into each box of mean 
value
Can you help on this what needs to be added in this code to show the data 
labels.




On May 09, 2018, at 08:10 PM, David L Carlson  wrote:

Your snapshot did not make it to the list. Only a few types of plots are 
accepted, e.g. .png. But we don't need a picture as much as we need a copy of 
your code with enough of your data to reproduce what you are trying to do. Use 
dput(head(x, 15)) to print out 15 lines of your data and include all of the R 
code you are using.


David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77843-4352

-Original Message-
From: R-help  On Behalf Of Jayaganesh 
Anbuganapathy
Sent: Tuesday, May 8, 2018 11:10 PM
To: r-help@r-project.org
Subject: [R] BoxPlot Adding Mean and Median Values

Dear Team - I would like to get your help on adding the values of mean and 
median of RTF as mentioned in the below snapshot. 

Please guide me out. Thanks for your help in advance.




__
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.
__
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.


Re: [R] BoxPlot Adding Mean and Median Values

2018-05-09 Thread David L Carlson
Your snapshot did not make it to the list. Only a few types of plots are 
accepted, e.g. .png. But we don't need a picture as much as we need a copy of 
your code with enough of your data to reproduce what you are trying to do. Use 
dput(head(x, 15)) to print out 15 lines of your data and include all of the R 
code you are using.


David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77843-4352

-Original Message-
From: R-help  On Behalf Of Jayaganesh 
Anbuganapathy
Sent: Tuesday, May 8, 2018 11:10 PM
To: r-help@r-project.org
Subject: [R] BoxPlot Adding Mean and Median Values

Dear Team - I would like to get your help on adding the values of mean and 
median of RTF as mentioned in the below snapshot. 

Please guide me out. Thanks for your help in advance.




__
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.
__
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.


Re: [R] Boxplot, formula interface, and labels.

2017-09-28 Thread David L Carlson
Just change the separator:

data(Titanic)
Titanic.df <- as.data.frame(Titanic)
boxplot(Freq~Class*Sex, Titanic.df, cex.axis=.6, sep="\n")

See attached .png.


David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77843-4352


-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ista Zahn
Sent: Thursday, September 28, 2017 12:27 PM
To: Ed Siefker 
Cc: r-help 
Subject: Re: [R] Boxplot, formula interface, and labels.

mybp <- boxplot(count ~ geno * tissue, data = mydata, plot = FALSE) mybp$names 
<- gsub("\\.", "\n", mybp$names)
bxp(mybp)

See ?boxplot for details.

Best,
Ista

On Thu, Sep 28, 2017 at 12:40 PM, Ed Siefker  wrote:
> I have data I'd like to plot using the formula interface to boxplot.
> I call boxplot like so:
>
> with(mydata, boxplot(count ~ geno * tissue))
>
> I get a boxplot with x axis labels like "wt.kidney".  I would like to 
> change the '.' to a newline.  Where is this separator configured?
>
> Thanks,
> -Ed
>
> __
> 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.

__
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.
__
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.

Re: [R] Boxplot, formula interface, and labels.

2017-09-28 Thread Ista Zahn
mybp <- boxplot(count ~ geno * tissue, data = mydata, plot = FALSE)
mybp$names <- gsub("\\.", "\n", mybp$names)
bxp(mybp)

See ?boxplot for details.

Best,
Ista

On Thu, Sep 28, 2017 at 12:40 PM, Ed Siefker  wrote:
> I have data I'd like to plot using the formula interface to boxplot.
> I call boxplot like so:
>
> with(mydata, boxplot(count ~ geno * tissue))
>
> I get a boxplot with x axis labels like "wt.kidney".  I would like
> to change the '.' to a newline.  Where is this separator configured?
>
> Thanks,
> -Ed
>
> __
> 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.

__
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.


Re: [R] Boxplot, formula interface, and labels.

2017-09-28 Thread Ed Siefker
Another way to think of this problem.  If I could get my hands on the
vector of names boxplot()
is creating, I could use gsub() to replace '.' with '\n'.

Is there something I could run before boxplot() that would give me
that vector of names which
I could then pass to boxplot()?

On Thu, Sep 28, 2017 at 11:40 AM, Ed Siefker  wrote:
> I have data I'd like to plot using the formula interface to boxplot.
> I call boxplot like so:
>
> with(mydata, boxplot(count ~ geno * tissue))
>
> I get a boxplot with x axis labels like "wt.kidney".  I would like
> to change the '.' to a newline.  Where is this separator configured?
>
> Thanks,
> -Ed

__
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.


Re: [R] Boxplot: Plot outliners in a different window

2015-09-28 Thread Jim Lemon
Hi Tagmarie,
Have a look at gap.boxplot (plotrix).

JIim


On Mon, Sep 28, 2015 at 4:50 PM, Tagmarie  wrote:

> Hi,
> I want to draw a usual boxplot. I have one outliner way up. It makes my
> boxes being drawn tiny. I do not want to delete the outliner as it is also
> of ecological importance.
> I know there is a way of drawing a second window on top of the boxplot
> which
> starts at a different y-axis-scales and includes the outliners there. I saw
> it on a poster once. I can't find the command though. Does anyone know it?
> Best regards,
> Tagmarie
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Boxplot-Plot-outliners-in-a-different-window-tp4712869.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> 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.
>

[[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.


Re: [R] boxplot overlap beeswarm

2015-09-24 Thread MacQueen, Don
I see that you have used
   add = TRUE
in the boxplot call. Add only makes sense if there is already a plot to
which to add the boxplot. But your boxplot is first, so there isn't
anything to add it to.

Try doing the beeswarm plot first?

Will the two plots will have the same y axis ranges?

Minor notes:
  you don't need both as.is and stringsAsFactors in read.csv
  read.csv by definition uses sep=','; you do not need to specify it.

If you want better help do the following:

  supply example data (use the "dput" function)

  saying it doesn't work is not enough -- describe how it did not work,
and include error messages, if any

  read the Posting Guide (link at the bottom of every email on R-help)

-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 9/24/15, 12:27 AM, "R-help on behalf of Julia89"
 wrote:

>Hi everybody,
>I'm new and i need help very fast.
>I will make a transparent boxplot overlap a beeswarm.
>I don't want to use ggplot2, i will use ggplot.
>Here is my own script but it doesn't worked.
>Maybe you can help me.
>Thanks in advance
>Julia
>
>require(beeswarm)#rohdaten boxplots
>
>rm(list=ls())
>setwd("C:/Dokumente und Einstellungen/jbellsta/Desktop/Paper")
>
>#read data
>data =
>read.csv(file="HypocotylCellLength.csv",stringsAsFactors=FALSE,header=TRUE
>,
>as.is=TRUE, sep=",")
>str(data)
>attach(data)
>
>
>#schreibe größten wert in Variable L.max
>L.max <- max(LengthMM)
>
>boxplot(LengthMM ~ Label,
>boxwex=.3, 
>outline=F,
>add=T, 
>ylim=c(0, L.max))  
>
>beeswarm(LengthMM ~ Label,  # Datenpunkte LengthMM~Label
>pch = 20,  
>cex= .6,   
>spacing = .3,  
>method =c("swarm"),
>col= c('grey') 
>) 
>
>
>
>
>
>
>--
>View this message in context:
>http://r.789695.n4.nabble.com/boxplot-overlap-beeswarm-tp4712727.html
>Sent from the R help mailing list archive at Nabble.com.
>
>__
>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.

__
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.

Re: [R] Boxplot using a shapefile

2015-06-16 Thread Preethi Balaji
Dear all,

Thanks very much for your help! I will keep your suggestions in mind
and will get back to you if I get stuck!



On Tue, Jun 16, 2015 at 1:28 PM, Roger Bivand  wrote:
> Boris Steipe  utoronto.ca> writes:
>
>>
>> Your workflow in principle is:
>>
>> - read the image into an object for which you can obtain values-per-pixel
> in a 2D structure;
>> - read the shapefile and convert into a polygon;
>> - determine the bounding box of the polygon;
>> - use the inout() function of the splancs package to get a list of
> booleans for the
>> points in the bounding box, TRUE if they are _inside_ the polygon;
>> - subset your image points to those for which inout() returns TRUE;
>> - plot as boxplot().
>>
>> The CRAN taskview http://cran.r-project.org/web/views/MedicalImaging.html
> has a section on general
>> image processing, guiding you to helpful packages.
>
> Actually, this is the wrong taskview if the data are as described, as
> Spatial data are covered in the Spatial task view at:
>
> http://cran.r-project.org/web/views/Spatial.html
>
> The workflow as described is also muddled: "[T]he shapefile takes the
> pixel values from the image and shows the distribution of pixels in
> the form of a boxplot" doesn't actually mean anything without further
> assumptions.
>
> A shapefile is an ESRI file format for GIS vector geometries (and
> attributes) that may be polygons, lines or points, and has an associated
> coordinate reference system; it is almost never used for other kinds of data.
>
> The "image" - presumably a GIS raster data file, should have the same
> coordinate reference system, or be transformed to the same system (use
> spTransform in the rgdal package, which is also the package you should use
> for reading the input data as it correctly reads input coordinate reference
> systems if available).
>
> The operation then needed is called an over() method in the sp package, and
> extract() in the raster package.
>
> If the shapefile contains points, the over query is asking the value(s) of
> the raster cells (pixels) at those points, given the same coordinate
> reference systems - but only one boxplot. If lines, for each line you may
> get a vector of values from raster cells intersected by the lines, and could
> make a boxplot for each line; you may wish to weight each value by the
> length of line in each cell. If polygons, as lines, with weighting by
> intersection area.
>
> The over vignette in the sp package is where you need to go to begin:
>
> http://cran.r-project.org/web/packages/sp/vignettes/over.pdf
>
> and the introduction to the raster package as a further reference:
>
> http://cran.r-project.org/web/packages/raster/vignettes/Raster.pdf
>
>>
>> Ask again if you get stuck - but(!):
>> - see here for some hints on how to ask questions productively:
>>   http://adv-r.had.co.nz/Reproducibility.html
>>
> http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
>> - ... and please read the posting guide and don't post in HTML.
>>
>
> Definitely! And note that this is a question that is better suited to the
> R-sig-geo list.
>
> Hope this clarifies,
>
> Roger
>
>> B.
>>
>> On Jun 15, 2015, at 7:19 AM, Preethi Balaji 
> gmail.com> wrote:
>>
>> > Dear all,
>> >
>> > I am trying to generate boxplots by giving a shapefile and an image as
>> > input. The shapefile takes the pixel values from the image and shows
>> > the distribution of pixels in the form of a boxplot.
>> >
>> > Can somebody please tell me how I can execute this in R?
>> >
>> > Many thanks!
>> >
>> > --
>> >
>> > Regards,
>> > Preethi Malur Balaji | PhD Student
>> > University College Cork | Cork, Ireland.
>
> __
> 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.



-- 

Regards,
Preethi Malur Balaji | PhD Student
University College Cork | Cork, Ireland.

__
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.


Re: [R] Boxplot using a shapefile

2015-06-16 Thread Roger Bivand
Boris Steipe  utoronto.ca> writes:

> 
> Your workflow in principle is:
> 
> - read the image into an object for which you can obtain values-per-pixel
in a 2D structure;
> - read the shapefile and convert into a polygon;
> - determine the bounding box of the polygon;
> - use the inout() function of the splancs package to get a list of
booleans for the
> points in the bounding box, TRUE if they are _inside_ the polygon;
> - subset your image points to those for which inout() returns TRUE;
> - plot as boxplot().
> 
> The CRAN taskview http://cran.r-project.org/web/views/MedicalImaging.html
has a section on general
> image processing, guiding you to helpful packages.

Actually, this is the wrong taskview if the data are as described, as
Spatial data are covered in the Spatial task view at:

http://cran.r-project.org/web/views/Spatial.html

The workflow as described is also muddled: "[T]he shapefile takes the 
pixel values from the image and shows the distribution of pixels in 
the form of a boxplot" doesn't actually mean anything without further
assumptions. 

A shapefile is an ESRI file format for GIS vector geometries (and
attributes) that may be polygons, lines or points, and has an associated
coordinate reference system; it is almost never used for other kinds of data. 

The "image" - presumably a GIS raster data file, should have the same
coordinate reference system, or be transformed to the same system (use
spTransform in the rgdal package, which is also the package you should use
for reading the input data as it correctly reads input coordinate reference
systems if available). 

The operation then needed is called an over() method in the sp package, and
extract() in the raster package. 

If the shapefile contains points, the over query is asking the value(s) of
the raster cells (pixels) at those points, given the same coordinate
reference systems - but only one boxplot. If lines, for each line you may
get a vector of values from raster cells intersected by the lines, and could
make a boxplot for each line; you may wish to weight each value by the
length of line in each cell. If polygons, as lines, with weighting by
intersection area.

The over vignette in the sp package is where you need to go to begin:

http://cran.r-project.org/web/packages/sp/vignettes/over.pdf

and the introduction to the raster package as a further reference:

http://cran.r-project.org/web/packages/raster/vignettes/Raster.pdf

> 
> Ask again if you get stuck - but(!):
> - see here for some hints on how to ask questions productively:
>   http://adv-r.had.co.nz/Reproducibility.html
>  
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
> - ... and please read the posting guide and don't post in HTML.
> 

Definitely! And note that this is a question that is better suited to the
R-sig-geo list.

Hope this clarifies,

Roger

> B.
> 
> On Jun 15, 2015, at 7:19 AM, Preethi Balaji 
gmail.com> wrote:
> 
> > Dear all,
> > 
> > I am trying to generate boxplots by giving a shapefile and an image as
> > input. The shapefile takes the pixel values from the image and shows
> > the distribution of pixels in the form of a boxplot.
> > 
> > Can somebody please tell me how I can execute this in R?
> > 
> > Many thanks!
> > 
> > -- 
> > 
> > Regards,
> > Preethi Malur Balaji | PhD Student
> > University College Cork | Cork, Ireland.

__
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.


Re: [R] Boxplot using a shapefile

2015-06-15 Thread Boris Steipe
Your workflow in principle is:

- read the image into an object for which you can obtain values-per-pixel in a 
2D structure;
- read the shapefile and convert into a polygon;
- determine the bounding box of the polygon;
- use the inout() function of the splancs package to get a list of booleans for 
the
points in the bounding box, TRUE if they are _inside_ the polygon;
- subset your image points to those for which inout() returns TRUE;
- plot as boxplot().

The CRAN taskview http://cran.r-project.org/web/views/MedicalImaging.html has a 
section on general image processing, guiding you to helpful packages.

Ask again if you get stuck - but(!):
- see here for some hints on how to ask questions productively:
  http://adv-r.had.co.nz/Reproducibility.html
  
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
- ... and please read the posting guide and don't post in HTML.


B.


On Jun 15, 2015, at 7:19 AM, Preethi Balaji  wrote:

> Dear all,
> 
> I am trying to generate boxplots by giving a shapefile and an image as
> input. The shapefile takes the pixel values from the image and shows
> the distribution of pixels in the form of a boxplot.
> 
> Can somebody please tell me how I can execute this in R?
> 
> Many thanks!
> 
> -- 
> 
> Regards,
> Preethi Malur Balaji | PhD Student
> University College Cork | Cork, Ireland.
> 
> __
> 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.

__
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.


Re: [R] Boxplot function error-help required

2015-06-13 Thread Kris Singh
Thank you all for the feedback.  I was actually amazed at not only the
number but quality of responses, and they were all helpful.  I have got it
working now, thanks again!

Kind regards,
Kris

2015-06-12 7:58 GMT+08:00 John Kane :

> Thanks Don,
>
> I suspected there was a Boxplot() out there by was too lazy to look.  I
> still don't see how the original code would work if label only had onevalue
> but I must admit what Boxplot() is actually doing is still confusing me.
>
> John Kane
> Kingston ON Canada
>
>
> > -Original Message-
> > From: macque...@llnl.gov
> > Sent: Thu, 11 Jun 2015 21:44:39 +
> > To: kris.si...@research.uwa.edu.au, r-help@r-project.org
> > Subject: Re: [R] Boxplot function error-help required
> >
> > In addition to the other answers, I would suggest that the next time you
> > get the "could not find function" message, try like this:
> >
> >  help.search('Boxplot')
> >
> > Among the output from that you should see
> >
> >   graphics::boxplot Box Plots
> >
> > which should lead you to "boxplot" instead of "Boxplot".
> >
> >
> > You may see considerably more output from help.search(), depending on
> > what
> > packages you have installed. For example, when I did it, I found that the
> > car package has a function named "Boxplot".
> >
> > -Don
> >
> >
> > --
> > Don MacQueen
> >
> > Lawrence Livermore National Laboratory
> > 7000 East Ave., L-627
> > Livermore, CA 94550
> > 925-423-1062
> >
> >
> >
> >
> >
> > On 6/11/15, 4:20 AM, "Kris Singh" 
> wrote:
> >
> > >Dear Sirm/Madam,
> >>
> > >Just wondering if someone could help me.  I've tried running a code on R
> > >and the code includes the following:
> >>
> >>> Boxplot(~Acc_S$Acc, label=Acc_S$Subj)
> >>
> > >But I receive the following  error message:
> >>
> > >*Error: could not find function "Boxplot"*
> >>
> > >I have tried installing all the packages but keep getting teh same error
> > >message.  The code runs on my supervisors R program and produces a
> > >boxplot,
> > >but doesn't on mine and am wondering if someone could assist me.
> >>
> > >Thanks in advance,
> > >Kris
> >>
> > >--
> > >*Kris Singh*
> > >Provisional Psychologist
> >>
> > >MPsych (Clinical Neuropsychology) / PhD Candidate
> > >Sanders Building, Room 1.10
> > >University of Western Australia
> > >35 Stirling Highway
> > >Crawley WA 6009
> >>
> > >Phone: (08) 6488 1418
> > >Email: kris.si...@research.uwa.edu.au
> >>
> > > [[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.
> >
> > __
> > 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.
>
> 
> Can't remember your password? Do you need a strong and secure password?
> Use Password manager! It stores your passwords & protects your account.
> Check it out at http://mysecurelogon.com/manager
>
>
>


-- 
*Kris Singh*
Provisional Psychologist

MPsych (Clinical Neuropsychology) / PhD Candidate
Sanders Building, Room 1.10
University of Western Australia
35 Stirling Highway
Crawley WA 6009

Phone: (08) 6488 1418
Email: kris.si...@research.uwa.edu.au

[[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.


Re: [R] Boxplot function error-help required

2015-06-11 Thread John Kane
Thanks Don,

I suspected there was a Boxplot() out there by was too lazy to look.  I still 
don't see how the original code would work if label only had onevalue but I 
must admit what Boxplot() is actually doing is still confusing me.

John Kane
Kingston ON Canada


> -Original Message-
> From: macque...@llnl.gov
> Sent: Thu, 11 Jun 2015 21:44:39 +
> To: kris.si...@research.uwa.edu.au, r-help@r-project.org
> Subject: Re: [R] Boxplot function error-help required
> 
> In addition to the other answers, I would suggest that the next time you
> get the "could not find function" message, try like this:
> 
>  help.search('Boxplot')
> 
> Among the output from that you should see
> 
>   graphics::boxplot Box Plots
> 
> which should lead you to "boxplot" instead of "Boxplot".
> 
> 
> You may see considerably more output from help.search(), depending on
> what
> packages you have installed. For example, when I did it, I found that the
> car package has a function named "Boxplot".
> 
> -Don
> 
> 
> --
> Don MacQueen
> 
> Lawrence Livermore National Laboratory
> 7000 East Ave., L-627
> Livermore, CA 94550
> 925-423-1062
> 
> 
> 
> 
> 
> On 6/11/15, 4:20 AM, "Kris Singh"  wrote:
> 
> >Dear Sirm/Madam,
>> 
> >Just wondering if someone could help me.  I've tried running a code on R
> >and the code includes the following:
>> 
>>> Boxplot(~Acc_S$Acc, label=Acc_S$Subj)
>> 
> >But I receive the following  error message:
>> 
> >*Error: could not find function "Boxplot"*
>> 
> >I have tried installing all the packages but keep getting teh same error
> >message.  The code runs on my supervisors R program and produces a
> >boxplot,
> >but doesn't on mine and am wondering if someone could assist me.
>> 
> >Thanks in advance,
> >Kris
>> 
> >--
> >*Kris Singh*
> >Provisional Psychologist
>> 
> >MPsych (Clinical Neuropsychology) / PhD Candidate
> >Sanders Building, Room 1.10
> >University of Western Australia
> >35 Stirling Highway
> >Crawley WA 6009
>> 
> >Phone: (08) 6488 1418
> >Email: kris.si...@research.uwa.edu.au
>> 
> > [[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.
> 
> __
> 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.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
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.


Re: [R] Boxplot function error-help required

2015-06-11 Thread David Winsemius

On Jun 11, 2015, at 2:44 PM, MacQueen, Don wrote:

> In addition to the other answers, I would suggest that the next time you
> get the "could not find function" message, try like this:
> 
> help.search('Boxplot')

 Spencer Graves uses RSiteSearch() as the underlying function for sos::findFn

-- 
David.
> 
> Among the output from that you should see
> 
>  graphics::boxplot Box Plots
> 
> which should lead you to "boxplot" instead of "Boxplot".
> 
> 
> You may see considerably more output from help.search(), depending on what
> packages you have installed. For example, when I did it, I found that the
> car package has a function named "Boxplot".
> 
> -Don
> 
> 
> -- 
> Don MacQueen
> 
> Lawrence Livermore National Laboratory
> 7000 East Ave., L-627
> Livermore, CA 94550
> 925-423-1062
> 
> 
> 
> 
> 
> On 6/11/15, 4:20 AM, "Kris Singh"  wrote:
> 
>> Dear Sirm/Madam,
>> 
>> Just wondering if someone could help me.  I've tried running a code on R
>> and the code includes the following:
>> 
>>> Boxplot(~Acc_S$Acc, label=Acc_S$Subj)
>> 
>> But I receive the following  error message:
>> 
>> *Error: could not find function "Boxplot"*
>> 
>> I have tried installing all the packages but keep getting teh same error
>> message.  The code runs on my supervisors R program and produces a
>> boxplot,
>> but doesn't on mine and am wondering if someone could assist me.
>> 
>> Thanks in advance,
>> Kris
>> 
>> -- 
>> *Kris Singh*
>> Provisional Psychologist
>> 
>> MPsych (Clinical Neuropsychology) / PhD Candidate
>> Sanders Building, Room 1.10
>> University of Western Australia
>> 35 Stirling Highway
>> Crawley WA 6009
>> 
>> Phone: (08) 6488 1418
>> Email: kris.si...@research.uwa.edu.au
>> 
>>  [[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.
> 
> __
> 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.

David Winsemius
Alameda, CA, USA

__
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.


Re: [R] Boxplot function error-help required

2015-06-11 Thread David Winsemius

On Jun 11, 2015, at 2:19 PM, John Kane wrote:

> Well it might have worked for your supervisor but I don't see how.  
> 
> As was mentioned it is boxplot , not Boxplot and the rest of the syntax looks 
> dodgy to say the least.

There is a "Boxplot" function in package 'car' and it has a labels argument 
which would be partially matched by a label argument, since it precedes the 
dots in the arglist.

So I would try this:


library(car)
Boxplot(~Acc_S$Acc, label=Acc_S$Subj)

-- 
David.

> 
> Try 
> boxplot(Acc_S$Subj ~ Acc_S$Acc)
> 
> I don't see how label = will work , ?boxplot says it should be names = and as 
> the code stands even that would be redundant.  
> 
> In any case here is a quick and dirty example that seems to work. 
> 
> dat1  <-  data.frame(aa = sample(letters[1:4], 20, replace = TRUE), bb = 
> rnorm(20), cc = rnorm(20) )
> boxplot(dat1$bb~ dat1$aa, names = c("alpha", "beta", "gamma", "delta"))
> 
> 
> Have a look at 
> http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
>  and http://adv-r.had.co.nz/Reproducibility.html
> for some suggestions on how to ask questions here.
> 
> Good luck
> 
> 
> 
> John Kane
> Kingston ON Canada
> 
> 
>> -Original Message-
>> From: kris.si...@research.uwa.edu.au
>> Sent: Thu, 11 Jun 2015 19:20:46 +0800
>> To: r-help@r-project.org
>> Subject: [R] Boxplot function error-help required
>> 
>> Dear Sirm/Madam,
>> 
>> Just wondering if someone could help me.  I've tried running a code on R
>> and the code includes the following:
>> 
>>> Boxplot(~Acc_S$Acc, label=Acc_S$Subj)
>> 
>> But I receive the following  error message:
>> 
>> *Error: could not find function "Boxplot"*
>> 
>> I have tried installing all the packages but keep getting teh same error
>> message.  The code runs on my supervisors R program and produces a
>> boxplot,
>> but doesn't on mine and am wondering if someone could assist me.
>> 
>> Thanks in advance,
>> Kris
>> 
>> --
>> *Kris Singh*
>> Provisional Psychologist
>> 
>> MPsych (Clinical Neuropsychology) / PhD Candidate
>> Sanders Building, Room 1.10
>> University of Western Australia
>> 35 Stirling Highway
>> Crawley WA 6009
>> 
>> Phone: (08) 6488 1418
>> Email: kris.si...@research.uwa.edu.au
>> 
>>  [[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.
> 
> 
> FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
> family!
> Visit http://www.inbox.com/photosharing to find out more!
> 
> __
> 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.

David Winsemius
Alameda, CA, USA

__
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.


Re: [R] Boxplot function error-help required

2015-06-11 Thread MacQueen, Don
In addition to the other answers, I would suggest that the next time you
get the "could not find function" message, try like this:

 help.search('Boxplot')

Among the output from that you should see

  graphics::boxplot Box Plots

which should lead you to "boxplot" instead of "Boxplot".


You may see considerably more output from help.search(), depending on what
packages you have installed. For example, when I did it, I found that the
car package has a function named "Boxplot".

-Don


-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 6/11/15, 4:20 AM, "Kris Singh"  wrote:

>Dear Sirm/Madam,
>
>Just wondering if someone could help me.  I've tried running a code on R
>and the code includes the following:
>
>> Boxplot(~Acc_S$Acc, label=Acc_S$Subj)
>
>But I receive the following  error message:
>
>*Error: could not find function "Boxplot"*
>
>I have tried installing all the packages but keep getting teh same error
>message.  The code runs on my supervisors R program and produces a
>boxplot,
>but doesn't on mine and am wondering if someone could assist me.
>
>Thanks in advance,
>Kris
>
>-- 
>*Kris Singh*
>Provisional Psychologist
>
>MPsych (Clinical Neuropsychology) / PhD Candidate
>Sanders Building, Room 1.10
>University of Western Australia
>35 Stirling Highway
>Crawley WA 6009
>
>Phone: (08) 6488 1418
>Email: kris.si...@research.uwa.edu.au
>
>   [[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.

__
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.


Re: [R] Boxplot function error-help required

2015-06-11 Thread John Kane
Well it might have worked for your supervisor but I don't see how.  

As was mentioned it is boxplot , not Boxplot and the rest of the syntax looks 
dodgy to say the least.

Try 
boxplot(Acc_S$Subj ~ Acc_S$Acc)

I don't see how label = will work , ?boxplot says it should be names = and as 
the code stands even that would be redundant.  

In any case here is a quick and dirty example that seems to work. 

 dat1  <-  data.frame(aa = sample(letters[1:4], 20, replace = TRUE), bb = 
rnorm(20), cc = rnorm(20) )
boxplot(dat1$bb~ dat1$aa, names = c("alpha", "beta", "gamma", "delta"))


Have a look at 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
 and http://adv-r.had.co.nz/Reproducibility.html
 for some suggestions on how to ask questions here.

Good luck



John Kane
Kingston ON Canada


> -Original Message-
> From: kris.si...@research.uwa.edu.au
> Sent: Thu, 11 Jun 2015 19:20:46 +0800
> To: r-help@r-project.org
> Subject: [R] Boxplot function error-help required
> 
> Dear Sirm/Madam,
> 
> Just wondering if someone could help me.  I've tried running a code on R
> and the code includes the following:
> 
>> Boxplot(~Acc_S$Acc, label=Acc_S$Subj)
> 
> But I receive the following  error message:
> 
> *Error: could not find function "Boxplot"*
> 
> I have tried installing all the packages but keep getting teh same error
> message.  The code runs on my supervisors R program and produces a
> boxplot,
> but doesn't on mine and am wondering if someone could assist me.
> 
> Thanks in advance,
> Kris
> 
> --
> *Kris Singh*
> Provisional Psychologist
> 
> MPsych (Clinical Neuropsychology) / PhD Candidate
> Sanders Building, Room 1.10
> University of Western Australia
> 35 Stirling Highway
> Crawley WA 6009
> 
> Phone: (08) 6488 1418
> Email: kris.si...@research.uwa.edu.au
> 
>   [[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.


FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
family!
Visit http://www.inbox.com/photosharing to find out more!

__
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.


Re: [R] Boxplot function error-help required

2015-06-11 Thread Richard M. Heiberger
R is case sensitive.

try "boxplot" not "Boxplot"

On Thu, Jun 11, 2015 at 7:20 AM, Kris Singh
 wrote:
> Dear Sirm/Madam,
>
> Just wondering if someone could help me.  I've tried running a code on R
> and the code includes the following:
>
>> Boxplot(~Acc_S$Acc, label=Acc_S$Subj)
>
> But I receive the following  error message:
>
> *Error: could not find function "Boxplot"*
>
> I have tried installing all the packages but keep getting teh same error
> message.  The code runs on my supervisors R program and produces a boxplot,
> but doesn't on mine and am wondering if someone could assist me.
>
> Thanks in advance,
> Kris
>
> --
> *Kris Singh*
> Provisional Psychologist
>
> MPsych (Clinical Neuropsychology) / PhD Candidate
> Sanders Building, Room 1.10
> University of Western Australia
> 35 Stirling Highway
> Crawley WA 6009
>
> Phone: (08) 6488 1418
> Email: kris.si...@research.uwa.edu.au
>
> [[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.

__
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.


Re: [R] boxplot axis font size

2014-05-25 Thread Rolf Turner

On 25/05/14 23:57, Brian Smith wrote:

Hi,

I wanted to have a different font for my x-axis and y-axis. How can I use
the par function to specify different font sizes for x and y axis? For
example:

x <- matrix(rnorm(2000),200,10)
colnames(x) <- letters[1:10]
par(cex.axis=0.5)
boxplot(x,cex=0.2)

But this sets the font size to 0.5 for both the x and y axis? How can I
make the y-axis to 1.5?


How about:

> boxplot(x,cex=0.2,axes=FALSE)
> axis(1,cex.axis=0.5)
> axis(2,cex.axis=1.5)

Does that get you what you want?

cheers,

Rolf Turner

__
R-help@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.


Re: [R] Boxplot colors

2014-05-22 Thread Shane Carey
Thanks very much, that worked superb!


On Thu, May 22, 2014 at 3:41 PM, Richard M. Heiberger wrote:

> ## Shane,
>
> ## This uses your color_list.   Your other variables weren't included
> in the email
> ## so I invented some data.
>
> ## I recommend bwplot() using panel=panel.bwplot.superpose
>
> ## and I also show how to use boxplot()
>
>
> ## install.packages("HH") ## if necessary.
> library(HH)
> ## install.packages("reshape2") ## if necessary.
> library(reshape2)
>
> ## you didn't include data, so I am making up some data
> pH <- data.frame(matrix(rnorm(200), 10, 20))
>
> bwplot(value ~ variable, data=melt(pH), col=unlist(colors_list),
>panel=panel.bwplot.superpose, groups=variable)
>
> boxplot(value ~ variable, data=melt(pH), col=unlist(colors_list))
>
> ## Rich
>
> On Thu, May 22, 2014 at 5:50 AM, Shane Carey  wrote:
> > Hi
> >
> > Im producing boxplots based on factors and rearranging them by median
> (This
> > is for a Geochemistry element). Im giving each boxplot a unique color
> based
> > on its level (factor) name.
> >
> > Im trying to produce a look up list to produce these colors as the order
> of
> > the boxplots will change from element to element.
> >
> > Here is by color lool up and boxplot code:
> >
> > colors_list<-list("Dalradian Appin Group quartzite"="#00","Sperrins
> > Dalradian (position uncertain)"="#D7D79E",
> >   "Namurian sandstone, shale"="#C7D79E","Lr-Mid
> Ordovocian
> > acid volcanics"="#FFD37F",
> >   "Tertiary granite, felsite"="#FF5500","Caledonian
> > appinite suite"="#946379",
> >   "Dalradian Argyll Gp quartzite"="#00","Slishwood
> > Division" ="#FFEDCC",
> >   "Dalradian S Highland Gp volcanics"="#00E6A9","LEITRIM
> > GP; Visean mudstone, sandstone"="#E6",
> >   "Dalradian Argyll Group"="#FFD9C7","Metadolerite or
> > amphibolite"="#4C7300",
> >   "Caledonian granite"="#FF7F7F","Dalradian Appin
> > Group"="#9EAAD7",
> >   "Lr-Mid Ordovician basic
> volcanics"="#448970","Ordovician
> > Granite"="#E6",
> >   "Tertiary basic intrusion"="#8400A8","Dalradian Argyll
> Gp
> > volcanics"="#00E6A9",
> >   "VISEAN \"\"basal
> clastics\"\""="#73A6A6","Carboniferous
> > volcs & minor intrus"="#AAFF00",
> >   "Metagabbro, metadiorite (Tyrone Plu"="#00A885","TYRONE
> > GP; Visean mudstone, sandstone"="#CC",
> >   "Late Visean-Westphalian 'ORS'"="#F5A27A","Dalradian S
> > Highland Group"="#FFD9C7",
> >   "Mid Devonian ORS"="#FFD37F","Mid-Up Ordovician
> > slate"="#C2753D",
> >   "Interbasaltic formation laterite, b"="#00","Visean
> > shelf limestone, shale"="#FF00C5",
> >   "Tertiary rhyolite (volc&intru)"="#FFEABE","COURCEYAN
> > \"\"basal clastics\"\""="#4D8099",
> >   "Up Dev-Lr Carb ORS"="#CDAA66","Tyrone CI
> > (Corvanaghan=?Slishwood"="#C9FFC9",
> >   "Visean basinal limestone
> \"\"Calp\"\""="#CFD6EB","Mid-Up
> > Ordovician g'wacke, sndst, shale"="#C29ED7",
> >   "Up Silurian - Lr Devonian ORS"="#CD8966","Westphalian
> > shale, sandstone"="#B2B2B2",
> >   "Upper Basalt Formation"="#FAC2E0","Causeway Tholeiite
> > Mbr"="#C29ED7",
> >   "Courceyan limestone"="#73B2FF","Tertiary minor
> > volcanics"="#E600A9",
> >   "Silurian sandstone, g'wacke, shale"="#ADE6D1","Up
> > Cretaceous limestone"="#73FFDF",
> >   "Lower Basalt Formation"="#E0A8C7","Ballycastle
> > succession"="#CCB3B3",
> >   "Navan Group"="#408CBF","Devonian basic volcs, minor
> > intrus"="#A5F57A",
> >   "Up. Ord-Sil \"\"Moffat shale\"\"
> > etc."="#DB","Oligocene clay, sand"="#704489",
> >   "Lr Jurassic mudstone"="#704489","Lr Jurassic
> > mudstone"="#267300",
> >   "Mid-Up Ordovician acid volcanics"="#448970","Armagh
> > Gp"="#8073B3",
> >   "Rathkenny Formation"="#704489","Triassic
> > sandstone"="#F7DB5E",
> >   "Waulsortian Limestones"="#B2B2B2","Permian
> > sandstone"="#F5CA7A",
> >   "Mid-Up Ordovician basic volcanics"="#448970")
> >
> >
> >
> boxplot(na.omit(C_pH$DATA.pH)~bymedian,axes=FALSE,horizontal=TRUE,col=unlist(colors_list),outwex=one,whisklty
> > = "solid",whisklwd=lwth,outcol= "black", outpch=dtsym,  outcex=dtsize)
> >
> > However it is not reading the colors based on the color_list given here.
> > Anyone know how to solve this?
> >
> > Thanks for your help
> >
> > --
> > Shane
> >
> > [[alternative HTML version deleted]]
> >
> > __
> > R-help@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.
>

Re: [R] Boxplot colors

2014-05-22 Thread Richard M. Heiberger
## Shane,

## This uses your color_list.   Your other variables weren't included
in the email
## so I invented some data.

## I recommend bwplot() using panel=panel.bwplot.superpose

## and I also show how to use boxplot()


## install.packages("HH") ## if necessary.
library(HH)
## install.packages("reshape2") ## if necessary.
library(reshape2)

## you didn't include data, so I am making up some data
pH <- data.frame(matrix(rnorm(200), 10, 20))

bwplot(value ~ variable, data=melt(pH), col=unlist(colors_list),
   panel=panel.bwplot.superpose, groups=variable)

boxplot(value ~ variable, data=melt(pH), col=unlist(colors_list))

## Rich

On Thu, May 22, 2014 at 5:50 AM, Shane Carey  wrote:
> Hi
>
> Im producing boxplots based on factors and rearranging them by median (This
> is for a Geochemistry element). Im giving each boxplot a unique color based
> on its level (factor) name.
>
> Im trying to produce a look up list to produce these colors as the order of
> the boxplots will change from element to element.
>
> Here is by color lool up and boxplot code:
>
> colors_list<-list("Dalradian Appin Group quartzite"="#00","Sperrins
> Dalradian (position uncertain)"="#D7D79E",
>   "Namurian sandstone, shale"="#C7D79E","Lr-Mid Ordovocian
> acid volcanics"="#FFD37F",
>   "Tertiary granite, felsite"="#FF5500","Caledonian
> appinite suite"="#946379",
>   "Dalradian Argyll Gp quartzite"="#00","Slishwood
> Division" ="#FFEDCC",
>   "Dalradian S Highland Gp volcanics"="#00E6A9","LEITRIM
> GP; Visean mudstone, sandstone"="#E6",
>   "Dalradian Argyll Group"="#FFD9C7","Metadolerite or
> amphibolite"="#4C7300",
>   "Caledonian granite"="#FF7F7F","Dalradian Appin
> Group"="#9EAAD7",
>   "Lr-Mid Ordovician basic volcanics"="#448970","Ordovician
> Granite"="#E6",
>   "Tertiary basic intrusion"="#8400A8","Dalradian Argyll Gp
> volcanics"="#00E6A9",
>   "VISEAN \"\"basal clastics\"\""="#73A6A6","Carboniferous
> volcs & minor intrus"="#AAFF00",
>   "Metagabbro, metadiorite (Tyrone Plu"="#00A885","TYRONE
> GP; Visean mudstone, sandstone"="#CC",
>   "Late Visean-Westphalian 'ORS'"="#F5A27A","Dalradian S
> Highland Group"="#FFD9C7",
>   "Mid Devonian ORS"="#FFD37F","Mid-Up Ordovician
> slate"="#C2753D",
>   "Interbasaltic formation laterite, b"="#00","Visean
> shelf limestone, shale"="#FF00C5",
>   "Tertiary rhyolite (volc&intru)"="#FFEABE","COURCEYAN
> \"\"basal clastics\"\""="#4D8099",
>   "Up Dev-Lr Carb ORS"="#CDAA66","Tyrone CI
> (Corvanaghan=?Slishwood"="#C9FFC9",
>   "Visean basinal limestone \"\"Calp\"\""="#CFD6EB","Mid-Up
> Ordovician g'wacke, sndst, shale"="#C29ED7",
>   "Up Silurian - Lr Devonian ORS"="#CD8966","Westphalian
> shale, sandstone"="#B2B2B2",
>   "Upper Basalt Formation"="#FAC2E0","Causeway Tholeiite
> Mbr"="#C29ED7",
>   "Courceyan limestone"="#73B2FF","Tertiary minor
> volcanics"="#E600A9",
>   "Silurian sandstone, g'wacke, shale"="#ADE6D1","Up
> Cretaceous limestone"="#73FFDF",
>   "Lower Basalt Formation"="#E0A8C7","Ballycastle
> succession"="#CCB3B3",
>   "Navan Group"="#408CBF","Devonian basic volcs, minor
> intrus"="#A5F57A",
>   "Up. Ord-Sil \"\"Moffat shale\"\"
> etc."="#DB","Oligocene clay, sand"="#704489",
>   "Lr Jurassic mudstone"="#704489","Lr Jurassic
> mudstone"="#267300",
>   "Mid-Up Ordovician acid volcanics"="#448970","Armagh
> Gp"="#8073B3",
>   "Rathkenny Formation"="#704489","Triassic
> sandstone"="#F7DB5E",
>   "Waulsortian Limestones"="#B2B2B2","Permian
> sandstone"="#F5CA7A",
>   "Mid-Up Ordovician basic volcanics"="#448970")
>
>
> boxplot(na.omit(C_pH$DATA.pH)~bymedian,axes=FALSE,horizontal=TRUE,col=unlist(colors_list),outwex=one,whisklty
> = "solid",whisklwd=lwth,outcol= "black", outpch=dtsym,  outcex=dtsize)
>
> However it is not reading the colors based on the color_list given here.
> Anyone know how to solve this?
>
> Thanks for your help
>
> --
> Shane
>
> [[alternative HTML version deleted]]
>
> __
> R-help@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.

__
R-help@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.


Re: [R] boxplot with x-axis time

2014-03-14 Thread MacQueen, Don
Something like:

tmp <- boxplot(V ~ date, data=pippo, plot=FALSE)

bxp(tmp, at=sort(unique(pippo$date))

You may need to adjust the x-axis limits and the box widths.

-Don

-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 3/13/14 2:30 PM, "giuseppe calamita"  wrote:

>Dear R-users,
>I want to plot boxplots of a single variable collected a few times during
>almost one year and I would like the x-axis to recognize the date-class
>of the variable.
>
>I found some topics in the archive but:
>- some questions were poorly posed
>(http://r.789695.n4.nabble.com/Boxplot-with-dates-td896401.html)  and so
>with no answer; 
>- others, only address the topic of have the date on the x-axes ordered
>(http://r.789695.n4.nabble.com/Using-boxplot-in-a-daily-time-series-td8430
>60.html#a843061);
>- finally, another topic
>(http://r.789695.n4.nabble.com/Boxplot-position-on-X-axis-relative-to-it-s
>-value-td2196020.html)is quite close to what I need but it is not exactly
>the same.
>
>I attached a simulated data.frame: it 2-column, the1-st are date and the
>2-nd is the variable.
>Here the code I use:
>
>pippo<- read.csv("pippo.csv")
>pippo$date<- as.Date(pippo$date, format="%Y-%m-%d")
>
>boxplot(V ~ date, data=pippo)
>
>I would like that the x-axis look like in this plot
>plot(V ~ date, data=pippo)
>where the thick reproduce the right time of the year .
>
>Thank you for your help

__
R-help@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.


Re: [R] BoxPlot basic help

2014-03-08 Thread Bert Gunter
You asked for basic training guides...

1. An Introduction to R ships with R. Did you miss it?

2. Google is your friend. There are a ton on the web. Search!

-- Bert

Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
H. Gilbert Welch




On Sat, Mar 8, 2014 at 9:18 AM, arun  wrote:
> Hi,
> May be this helps:
> dat <- read.table(text="Designation Basic
> ASA .25
> ASA .28
> ASA .32
> TASA   .45
> TASA   .33
> TASA   .43",sep="",header=TRUE,stringsAsFactors=FALSE)
>  boxplot(Basic~Designation,data=dat,col=2:3)
> #or
> library(ggplot2)
>  ggplot(dat,aes(x=Designation,y=Basic,fill=Designation))+geom_boxplot()
>
> A.K.
>
> Hello - I've been away from stat programming for a very long time and
> am just getting back into it. I'm not used to a non GUI interface which
> is where I'm running into problems with R.
>
> I have a data set that i'd like to use to create boxplots.
>
> the dataset sample looks as follows
>
> Designation Basic
> ASA .25
> ASA .28
> ASA .32
> TASA   .45
> TASA   .33
> TASA   .43
>
> I have my grouping variable under 'designation' that i would like to use to 
> create the boxplot.
>
> Could i request some help on the syntax to use after i have read
>  this data file into a variable, say 'data' to group the information as
> per the grouping variable ? how do i define the grouping variable and
> use it in the boxplot command ?
>
> Any information would be greatly appreciated. in addition, if
> you could also point me to some basic training guides, that would be
> helpful as well.
>
> Thanks!
>
> Raol
>
> __
> R-help@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.

__
R-help@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.


Re: [R] BoxPlot basic help

2014-03-08 Thread arun
Hi,
May be this helps:
dat <- read.table(text="Designation Basic
ASA .25
ASA .28
ASA .32
TASA   .45
TASA   .33
TASA   .43",sep="",header=TRUE,stringsAsFactors=FALSE) 
 boxplot(Basic~Designation,data=dat,col=2:3)
#or
library(ggplot2)
 ggplot(dat,aes(x=Designation,y=Basic,fill=Designation))+geom_boxplot()

A.K.

Hello - I've been away from stat programming for a very long time and 
am just getting back into it. I'm not used to a non GUI interface which 
is where I'm running into problems with R. 

I have a data set that i'd like to use to create boxplots. 

the dataset sample looks as follows 

Designation Basic 
ASA         .25 
ASA         .28 
ASA         .32 
TASA       .45 
TASA       .33 
TASA       .43 

I have my grouping variable under 'designation' that i would like to use to 
create the boxplot. 

Could i request some help on the syntax to use after i have read
 this data file into a variable, say 'data' to group the information as 
per the grouping variable ? how do i define the grouping variable and 
use it in the boxplot command ? 

Any information would be greatly appreciated. in addition, if 
you could also point me to some basic training guides, that would be 
helpful as well. 

Thanks! 

Raol

__
R-help@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.


Re: [R] Boxplot from statistics of original data

2013-09-26 Thread Jim Lemon

On 09/27/2013 12:10 AM, Rodrigo César da Silva wrote:


Hi, I have a data set that contains a set of universities and a number of 
statistics about the performance of students on an exam.  A sample of the table 
follows:

Institutions_Name

Mean

Median

Minimum

Maximum

1Quartile

3Quartile

CENTRO UNIVERSITÁRIO LUTERANO DE MANAUS

58,5

57,5

0

98

27,6%

13,8%
...


Hi Rodrigo,
I was about to answer this post last night when I noticed that you seem 
to have different measures for the last two values in each set. Unless I 
am sadly mistaken, the first and third quartile should bracket the 
median. I would check what these two figures mean before trying to build 
a boxplot.


Jim

__
R-help@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.


Re: [R] Boxplot from statistics of original data

2013-09-26 Thread Greg Snow
The boxplot function calls other functions, the boxplot.stats function
calculates the stats, then the bxp function does the actual plotting.  So
just look at the structure of the object that is passed to bxp, reformat
your data to that structure, and call bxp directly.


On Thu, Sep 26, 2013 at 8:10 AM, Rodrigo César da Silva <
rodrigo.si...@ipplan.org.br> wrote:

>
> Hi, I have a data set that contains a set of universities and a number of
> statistics about the performance of students on an exam.  A sample of the
> table follows:
>
> Institutions_Name
>
> Mean
>
> Median
>
> Minimum
>
> Maximum
>
> 1Quartile
>
> 3Quartile
>
> CENTRO UNIVERSITÁRIO LUTERANO DE MANAUS
>
> 58,5
>
> 57,5
>
> 0
>
> 98
>
> 27,6%
>
> 13,8%
>
> CENTRO UNIVERSITÁRIO DO NORTE
>
> 49
>
> 47,3
>
> 15
>
> 85
>
> 36,5%
>
> 8,1%
>
> FACULDADE METROPOLITANA DE MANAUS
>
> 41,2
>
> 41
>
> 15
>
> 71,5
>
> 64,3%
>
> 0,0%
>
> UNIVERSIDADE FEDERAL DO AMAPÁ
>
> 62,6
>
> 63,5
>
> 42
>
> 80
>
> 20,0%
>
> 40,0%
>
> CENTRO DE ENSINO SUPERIOR DO AMAPÁ
>
> 56,3
>
> 57,5
>
> 26,5
>
> 87,5
>
> 7,4%
>
> 14,8%
>
>
>
> Can I build a set of bloxplots in R using only this information? I know
> how to build a boxplot using the boxplot function, but I do not have access
> to the actual data, just this statistics.
>
> Thanks,
>
>
> Rodrigo Cesar da Silva
> Analista de Informações
> IPPLAN - Instituto de Pesquisa Adm e Planejamento
> Tel.: (12) 99258-1042
>
>
>
> [[alternative HTML version deleted]]
>
>
> __
> R-help@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.
>
>


-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] boxplot with grouped variables

2013-05-11 Thread S Ellison
You can't mix number and character data in a data frame column, so you will 
probably find that all your variables are factors, not numbers. Try, for example
class(Daten$V2)

It looks like you failed to specify 'header=TRUE' in a read.table statement. 
Reread the data with headers properly treated so that those first items become 
the variable names.

In additon, Daten$V2[Daten$V3=="m"]) will only give you data for rows in which 
V3=="m", which will be a single boxplot. (see ?"[" for what that subsetting 
operation does). To plot all combinations ( if V2 were correctly numeric) you 
could try
boxplot(V2~V1+V3, data=Daten)

S Ellison

From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of 
maggy yan [kiot...@gmail.com]
Sent: 11 May 2013 16:40
To: R-help@r-project.org
Subject: [R]  boxplot with grouped variables

my dataset looked like this in the beginning:

>Daten
  V1  V2 V3
1  Dosis Gewicht Geschlecht
2  06.62  m
3  06.65  m
4  05.78  m
5  05.63  m

I need box plots for V2 with all combination of V1 and V3, so I deleted the
first row, and tried this:
boxplot(Daten$V2[Daten$V3=="m"])
but it does not work and I have no clue what I did wrong.
I'm thankful for any help!

[[alternative HTML version deleted]]

__
R-help@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.

***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
R-help@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.


Re: [R] boxplot with grouped variables

2013-05-11 Thread Bert Gunter
It will not work because the presence of the first row means that all
the variables are read in as factors, not numeric. You must convert
numeric variables to numeric **after** eliminating the first row, or
read the data in using read.table(..., head=TRUE). See ?read.table for
details.

**After** the above changes, perhaps

with(Daten, boxplot(Gewicht ~ interaction(Dosis,Geshlecht, drop=TRUE)) )

will work if you read in column names properly. Otherwise, V2
~interaction(V1,V3, drop=TRUE) if you do the conversions to numeric.

Please read *An Introduction to R" or other online R tutorial before
posting further here. You need to understand basic R data handling
before you proceed. At present, you do not.

-- Bert



On Sat, May 11, 2013 at 8:40 AM, maggy yan  wrote:
> my dataset looked like this in the beginning:
>
>>Daten
>   V1  V2 V3
> 1  Dosis Gewicht Geschlecht
> 2  06.62  m
> 3  06.65  m
> 4  05.78  m
> 5  05.63  m
>
> I need box plots for V2 with all combination of V1 and V3, so I deleted the
> first row, and tried this:
> boxplot(Daten$V2[Daten$V3=="m"])
> but it does not work and I have no clue what I did wrong.
> I'm thankful for any help!
>
> [[alternative HTML version deleted]]
>
> __
> R-help@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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

__
R-help@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.


Re: [R] boxplot with grouped variables

2013-05-11 Thread arun
Hi,
Try this:
dat1<- read.table(text="
    V1  V2 V3
1  Dosis Gewicht Geschlecht
2  0    6.62  m
3  0    6.65  m
4  0    5.78  m
5  0    5.63  m
6  1    6.78  m
7  1    6.45  m
8  1    5.68  m
9  1    5.89  m
10  0    6.72  f
11  0    6.75  f
12  0    5.89  f
13  0    5.78  f
14  1    6.89  f
15  1    7.75  f
16  1    4.89  f
17  1    5.89  f
",header=TRUE,sep="",stringsAsFactors=FALSE) 
dat2<-dat1[-1,]
boxplot(as.numeric(dat2$V2)[dat2$V3=="m"])# works
dat2$V2<- as.numeric(dat2$V2)
library(ggplot2)
library(plyr)
library(reshape2)
 dat2New<-mutate(melt(dat2,id.var=c("V1","V3")),combin= 
as.character(interaction(V1,V3,sep="_")))
ggplot(dat2New,aes(x=combin,y=value))+geom_boxplot()
#or
ggplot(dat2New,aes(x=combin,y=value))+geom_boxplot()+facet_wrap(~V3,scales="free_x",ncol=2)
A.K.



- Original Message -
From: maggy yan 
To: R-help@r-project.org
Cc: 
Sent: Saturday, May 11, 2013 11:40 AM
Subject: [R]  boxplot with grouped variables

my dataset looked like this in the beginning:

>Daten
      V1      V2         V3
1  Dosis Gewicht Geschlecht
2      0    6.62          m
3      0    6.65          m
4      0    5.78          m
5      0    5.63          m

I need box plots for V2 with all combination of V1 and V3, so I deleted the
first row, and tried this:
boxplot(Daten$V2[Daten$V3=="m"])
but it does not work and I have no clue what I did wrong.
I'm thankful for any help!

    [[alternative HTML version deleted]]

__
R-help@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.


__
R-help@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.


Re: [R] Boxplot Labels OK

2013-04-10 Thread Jose Iparraguirre
Beatriz,

In this case, use the car package and run the following:

> bp <- Boxplot(DATA$ave, data= DATA, main= "Average Size", labels=DATA$num, 
> Id.method=c("y"))

This will print out the labels 211 & 225 beside the outlier points. As you can 
see, the instruction assigns the values in the num column in the DATA data 
frame to the labels.

If you prefer the interactive option, replace id.method=c("y") with 
id.method=c("identify")

Kind regards,

José

José Iparraguirre
Chief Economist
Age UK

T 020 303 31482
E jose.iparragui...@ageuk.org.uk
Twitter @jose.iparraguirre@ageuk


Tavis House, 1- 6 Tavistock Square
London, WC1H 9NB
www.ageuk.org.uk | ageukblog.org.uk | @ageukcampaigns 





-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Beatriz González Domínguez
Sent: 09 April 2013 17:32
To: r-help-ow...@r-project.org; R Help 1; R Help 2
Subject: [R] Boxplot Labels OK

Dear all,

I have just sent an enquiry but probably I hadn’t expressed myself properly. 

Could anyone help me with the following?

When I run the code on my data I get a boxplot with outliers identified by 
numbers 200 & 201.
However, what I would like is to label these outliers with their corresponding 
“DATA$num� values of the data frame. 
In this example, the outliers should be labelled as: 211 & 225

Do you have any idea of how I could do this?

Please, if you need any more details just get in touch.

Many thanks in advance! 

## R CODE
#DATA
num <- as.numeric(200:225)
ave <- c(0.5, 1, 1.6, 2, 2, 2.3, 2.5, 2.4, 3, 3.2, 3.3, 7.2, 4, 4.8, 3.5, 2.7, 
3.1, 2.8, 4.1, 2.0, 2.5, 2.1, 3.4, 2.5, 2.6, 7) DATA <- data.frame(cbind(num, 
ave)) rm(num, ave)

#BOXPLOT
x11()
bp <- boxplot(DATA$ave, data= DATA, main= "Average Size") identify(x= bp$group, 
y= bp$out, labels= DATA$num, cex = 0.7)

Bea
[[alternative HTML version deleted]]

Please donate to the Syria Crisis Appeal by text or online:

To donate £5 by mobile, text SYRIA to 70800.  To donate online, please visit 

http://www.ageinternational.org.uk/syria

Over one million refugees are desperately in need of water, food, healthcare, 
warm clothing, 
blankets and shelter; Age International urgently needs your support to help 
affected older refugees.


Age International is a subsidiary charity of Age UK and a member of the 
Disasters Emergency Committee (DEC).  
The DEC launches and co-ordinates national fundraising appeals for public 
donations on behalf of its member agencies.

Texts cost £5 plus one standard rate message.  Age International will receive a 
minimum of £4.96.  
More info at ageinternational.org.uk/SyriaTerms



 

---
Age UK is a registered charity and company limited by guarantee, (registered 
charity number 1128267, registered company number 6825798). 
Registered office: Tavis House, 1-6 Tavistock Square, London WC1H 9NA.

For the purposes of promoting Age UK Insurance, Age UK is an Appointed 
Representative of Age UK Enterprises Limited, Age UK is an Introducer 
Appointed Representative of JLT Benefit Solutions Limited and Simplyhealth 
Access for the purposes of introducing potential annuity and health 
cash plans customers respectively.  Age UK Enterprises Limited, JLT Benefit 
Solutions Limited and Simplyhealth Access are all authorised and 
regulated by the Financial Services Authority. 
--

This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are 
addressed. If you receive a message in error, please advise the sender and 
delete immediately.

Except where this email is sent in the usual course of our business, any 
opinions expressed in this email are those of the author and do not 
necessarily reflect the opinions of Age UK or its subsidiaries and associated 
companies. Age UK monitors all e-mail transmissions passing 
through its network and may block or modify mails which are deemed to be 
unsuitable.

Age Concern England (charity number 261794) and Help the Aged (charity number 
272786) and their trading and other associated companies merged 
on 1st April 2009.  Together they have formed the Age UK Group, dedicated to 
improving the lives of people in later life.  The three national 
Age Concerns in Scotland, Northern Ireland and Wales have also merged with Help 
the Aged in these nations to form three registered charities: 
Age Scotland, Age NI, Age Cymru.



__
R-help@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.


Re: [R] Boxplot Labels OK

2013-04-09 Thread Rui Barradas

Hello,

I'm glad it help. You should cc the list, maybe it will be of use to others.

Rui Barradas

Em 09-04-2013 21:00, Beatriz González Domínguez escreveu:

I have solved it, many thanks!

-Original Message- From: Rui Barradas
Sent: Tuesday, April 09, 2013 7:33 PM
To: Beatriz González Domínguez
Cc: r-help-ow...@r-project.org ; R Help 1 ; R Help 2
Subject: Re: [R] Boxplot Labels OK

Hello,

The answers you had in another thread could lead you to

bp <- boxplot(DATA$ave, data= DATA, main= "Average Size")
idx <- which(DATA$ave %in% bp$out)
text(x= bp$group, y= bp$out, labels= DATA$num[idx], cex = 0.7, pos = 4)


Hope this helps,

Rui Barradas

Em 09-04-2013 17:31, Beatriz González Domínguez escreveu:

Dear all,

I have just sent an enquiry but probably I hadn’t expressed myself
properly.

Could anyone help me with the following?

When I run the code on my data I get a boxplot with outliers
identified by numbers 200 & 201.
However, what I would like is to label these outliers with their
corresponding “DATA$num� values of the data frame.
In this example, the outliers should be labelled as: 211 & 225

Do you have any idea of how I could do this?

Please, if you need any more details just get in touch.

Many thanks in advance!

## R CODE
#DATA
num <- as.numeric(200:225)
ave <- c(0.5, 1, 1.6, 2, 2, 2.3, 2.5, 2.4, 3, 3.2, 3.3, 7.2, 4, 4.8,
3.5, 2.7, 3.1, 2.8, 4.1, 2.0, 2.5, 2.1, 3.4, 2.5, 2.6, 7)
DATA <- data.frame(cbind(num, ave))
rm(num, ave)

#BOXPLOT
x11()
bp <- boxplot(DATA$ave, data= DATA, main= "Average Size")
identify(x= bp$group, y= bp$out, labels= DATA$num, cex = 0.7)

Bea
[[alternative HTML version deleted]]



__
R-help@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.





__
R-help@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.


Re: [R] Boxplot Labels OK

2013-04-09 Thread Rui Barradas

Hello,

The answers you had in another thread could lead you to

bp <- boxplot(DATA$ave, data= DATA, main= "Average Size")
idx <- which(DATA$ave %in% bp$out)
text(x= bp$group, y= bp$out, labels= DATA$num[idx], cex = 0.7, pos = 4)


Hope this helps,

Rui Barradas

Em 09-04-2013 17:31, Beatriz González Domínguez escreveu:

Dear all,

I have just sent an enquiry but probably I hadn’t expressed myself properly.

Could anyone help me with the following?

When I run the code on my data I get a boxplot with outliers identified by numbers 
200 & 201.
However, what I would like is to label these outliers with their corresponding 
“DATA$num� values of the data frame.
In this example, the outliers should be labelled as: 211 & 225

Do you have any idea of how I could do this?

Please, if you need any more details just get in touch.

Many thanks in advance!

## R CODE
#DATA
num <- as.numeric(200:225)
ave <- c(0.5, 1, 1.6, 2, 2, 2.3, 2.5, 2.4, 3, 3.2, 3.3, 7.2, 4, 4.8, 3.5, 2.7, 
3.1, 2.8, 4.1, 2.0, 2.5, 2.1, 3.4, 2.5, 2.6, 7)
DATA <- data.frame(cbind(num, ave))
rm(num, ave)

#BOXPLOT
x11()
bp <- boxplot(DATA$ave, data= DATA, main= "Average Size")
identify(x= bp$group, y= bp$out, labels= DATA$num, cex = 0.7)

Bea
[[alternative HTML version deleted]]



__
R-help@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.



__
R-help@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.


Re: [R] Boxplot Labels

2013-04-09 Thread David L Carlson
The problem is that identify() is designed for a scatterplot not a boxplot.
You can use it but you have to feed it the correct x and y coordinates:

identify(rep(1, nrow(DATA)), DATA$ave, cex=.7)

This will give you "26" as you requested if you click on the outlying point.
That is the row name for the point. You specified DATA$num as your labels,
but they are the same as the row names so there is no need to add that. You
can also identify points at the whiskers, hinges, or median, but they will
probably overprint the lines.

I wasn't sure if your definition of num was intentional or a mistype, eg:

> num <- as.numeric(seq(100:125))
> num
 [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
25
[26] 26
> num <- as.numeric(seq(100, 125))
> num
 [1] 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
118
[20] 119 120 121 122 123 124 125
>

If you wanted the numbers from 1 to 26, num <- 1:26 would be more compact.

--
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352



> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of John Kane
> Sent: Tuesday, April 09, 2013 10:45 AM
> To: Beatriz González Domínguez; R Help; r-help@r-project.org
> Subject: Re: [R] Boxplot Labels
> 
>   p <- boxplot(dat1$ave, data= dat1, main= "Average Size", yaxt = "n")
>   text(1.1, , y  = max(datDAT1$ave), label = "26", cex = .7)
> 
> but I don't understand
>  #I would like the labels that appear in the boxplot to be DATA$num
> values.
> 
> You want 26 values potted?
> 
> 
> 
> John Kane
> Kingston ON Canada
> 
> 
> > -Original Message-
> > From: aguitatie...@hotmail.com
> > Sent: Tue, 9 Apr 2013 16:17:01 +0100
> > To: r-help-boun...@r-project.org, r-help@r-project.org
> > Subject: [R] Boxplot Labels
> >
> > #Dear all,
> >
> > #Could anyone help me with the following?
> > #DATA
> > num <- as.numeric(seq(100:125))
> > ave <- c(0.5, 1, 1.6, 2, 2, 2.3, 2.5, 2.4, 3, 3.2, 3.3, 4, 4.8, 3.5,
> 2.7,
> > 3.1, 2.8, 3.5, 4.1, 2.0, 2.5, 2.1, 3.4, 2.5, 2.6, 7)
> > DATA <- data.frame(cbind(num, ave))
> > rm(num, ave)
> >
> > #BOXPLOT
> > x11()
> > bp <- boxplot(DATA$ave, data= DATA, main= "Average Size")
> > identify(x= bp$group, y= bp$out, labels= DATA$num, cex = 0.7)
> > #I would like the labels that appear in the boxplot to be DATA$num
> > values.
> > #When I identify the outlier it appears a "1" when I would like to
> appear
> > a "26"
> >
> > #Do you have any idea of how I could do that?
> >
> > #Many thanks!
> > #Bea
> > [[alternative HTML version deleted]]
> >
> > __
> > R-help@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.
> 
> 
> FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on
> your desktop!
> 
> __
> R-help@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.

__
R-help@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.


Re: [R] Boxplot Labels

2013-04-09 Thread Rui Barradas

Hello,

The construct data.frame(cbind(...)) is not at all needed, the following 
is much better.


dat1 <- data.frame(num, ave)


Also, I've modified the text() call a bit, in order to have R tell the 
dat1$num corresponding to the (unique) max of ave, and with an extra 
argument, pos. This would allow for placement of the label near the point.


p <- boxplot(dat1$ave, data= dat1, main= "Average Size", yaxt = "n")
text(1, , y = max(dat1$ave), label = dat1$num[which.max(dat1$ave)], cex 
= .7, pos = 4)



Hope this helps,

Rui Barradas


Em 09-04-2013 16:44, John Kane escreveu:

   p <- boxplot(dat1$ave, data= dat1, main= "Average Size", yaxt = "n")
   text(1.1, , y  = max(dat1$ave), label = "26", cex = .7)

but I don't understand
  #I would like the labels that appear in the boxplot to be DATA$num values.

You want 26 values potted?



John Kane
Kingston ON Canada



-Original Message-
From: aguitatie...@hotmail.com
Sent: Tue, 9 Apr 2013 16:17:01 +0100
To: r-help-boun...@r-project.org, r-help@r-project.org
Subject: [R] Boxplot Labels

#Dear all,

#Could anyone help me with the following?
#DATA
num <- as.numeric(seq(100:125))
ave <- c(0.5, 1, 1.6, 2, 2, 2.3, 2.5, 2.4, 3, 3.2, 3.3, 4, 4.8, 3.5, 2.7,
3.1, 2.8, 3.5, 4.1, 2.0, 2.5, 2.1, 3.4, 2.5, 2.6, 7)
DATA <- data.frame(cbind(num, ave))
rm(num, ave)

#BOXPLOT
x11()
bp <- boxplot(DATA$ave, data= DATA, main= "Average Size")
identify(x= bp$group, y= bp$out, labels= DATA$num, cex = 0.7)
#I would like the labels that appear in the boxplot to be DATA$num
values.
#When I identify the outlier it appears a "1" when I would like to appear
a "26"

#Do you have any idea of how I could do that?

#Many thanks!
#Bea
[[alternative HTML version deleted]]

__
R-help@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.



FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your 
desktop!

__
R-help@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.



__
R-help@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.


Re: [R] Boxplot Labels

2013-04-09 Thread John Kane
  p <- boxplot(dat1$ave, data= dat1, main= "Average Size", yaxt = "n")
  text(1.1, , y  = max(dat1$ave), label = "26", cex = .7)
  
but I don't understand 
 #I would like the labels that appear in the boxplot to be DATA$num values.

You want 26 values potted?



John Kane
Kingston ON Canada


> -Original Message-
> From: aguitatie...@hotmail.com
> Sent: Tue, 9 Apr 2013 16:17:01 +0100
> To: r-help-boun...@r-project.org, r-help@r-project.org
> Subject: [R] Boxplot Labels
> 
> #Dear all,
> 
> #Could anyone help me with the following?
> #DATA
> num <- as.numeric(seq(100:125))
> ave <- c(0.5, 1, 1.6, 2, 2, 2.3, 2.5, 2.4, 3, 3.2, 3.3, 4, 4.8, 3.5, 2.7,
> 3.1, 2.8, 3.5, 4.1, 2.0, 2.5, 2.1, 3.4, 2.5, 2.6, 7)
> DATA <- data.frame(cbind(num, ave))
> rm(num, ave)
> 
> #BOXPLOT
> x11()
> bp <- boxplot(DATA$ave, data= DATA, main= "Average Size")
> identify(x= bp$group, y= bp$out, labels= DATA$num, cex = 0.7)
> #I would like the labels that appear in the boxplot to be DATA$num
> values.
> #When I identify the outlier it appears a "1" when I would like to appear
> a "26"
> 
> #Do you have any idea of how I could do that?
> 
> #Many thanks!
> #Bea
>   [[alternative HTML version deleted]]
> 
> __
> R-help@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.


FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your 
desktop!

__
R-help@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.


Re: [R] Boxplot Labels

2013-04-09 Thread Jose Iparraguirre
Estimada Beatriz,

If you use the Box.plot function in the car package (notice that here it's 
Box.plot, not box.plot), and add the argument id.method=c("identify"), it 
should work.
You only need one instruction:

R> library(car)
R> bp <- Boxplot(DATA$ave, data= DATA, main= "Average 
Size",id.method=c("identify"))

Kind regards,

José 

José Iparraguirre
Chief Economist
Age UK

T 020 303 31482
E jose.iparragui...@ageuk.org.uk
Twitter @jose.iparraguirre@ageuk


Tavis House, 1- 6 Tavistock Square
London, WC1H 9NB
www.ageuk.org.uk | ageukblog.org.uk | @ageukcampaigns 




-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Beatriz González Domínguez
Sent: 09 April 2013 16:17
To: R Help; r-help@r-project.org
Subject: [R] Boxplot Labels

#Dear all,

#Could anyone help me with the following?
#DATA
num <- as.numeric(seq(100:125))
ave <- c(0.5, 1, 1.6, 2, 2, 2.3, 2.5, 2.4, 3, 3.2, 3.3, 4, 4.8, 3.5, 2.7, 3.1, 
2.8, 3.5, 4.1, 2.0, 2.5, 2.1, 3.4, 2.5, 2.6, 7)
DATA <- data.frame(cbind(num, ave))
rm(num, ave)

#BOXPLOT
x11()
bp <- boxplot(DATA$ave, data= DATA, main= "Average Size")
identify(x= bp$group, y= bp$out, labels= DATA$num, cex = 0.7) 
#I would like the labels that appear in the boxplot to be DATA$num values. 
#When I identify the outlier it appears a "1" when I would like to appear a "26"

#Do you have any idea of how I could do that?

#Many thanks!
#Bea
[[alternative HTML version deleted]]

__
R-help@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.

Please donate to the Syria Crisis Appeal by text or online:

To donate £5 by mobile, text SYRIA to 70800.  To donate online, please visit 

http://www.ageinternational.org.uk/syria

Over one million refugees are desperately in need of water, food, healthcare, 
warm clothing, 
blankets and shelter; Age International urgently needs your support to help 
affected older refugees.


Age International is a subsidiary charity of Age UK and a member of the 
Disasters Emergency Committee (DEC).  
The DEC launches and co-ordinates national fundraising appeals for public 
donations on behalf of its member agencies.

Texts cost £5 plus one standard rate message.  Age International will receive a 
minimum of £4.96.  
More info at ageinternational.org.uk/SyriaTerms



 

---
Age UK is a registered charity and company limited by guarantee, (registered 
charity number 1128267, registered company number 6825798). 
Registered office: Tavis House, 1-6 Tavistock Square, London WC1H 9NA.

For the purposes of promoting Age UK Insurance, Age UK is an Appointed 
Representative of Age UK Enterprises Limited, Age UK is an Introducer 
Appointed Representative of JLT Benefit Solutions Limited and Simplyhealth 
Access for the purposes of introducing potential annuity and health 
cash plans customers respectively.  Age UK Enterprises Limited, JLT Benefit 
Solutions Limited and Simplyhealth Access are all authorised and 
regulated by the Financial Services Authority. 
--

This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are 
addressed. If you receive a message in error, please advise the sender and 
delete immediately.

Except where this email is sent in the usual course of our business, any 
opinions expressed in this email are those of the author and do not 
necessarily reflect the opinions of Age UK or its subsidiaries and associated 
companies. Age UK monitors all e-mail transmissions passing 
through its network and may block or modify mails which are deemed to be 
unsuitable.

Age Concern England (charity number 261794) and Help the Aged (charity number 
272786) and their trading and other associated companies merged 
on 1st April 2009.  Together they have formed the Age UK Group, dedicated to 
improving the lives of people in later life.  The three national 
Age Concerns in Scotland, Northern Ireland and Wales have also merged with Help 
the Aged in these nations to form three registered charities: 
Age Scotland, Age NI, Age Cymru.




__
R-help@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.


Re: [R] boxplot

2013-03-24 Thread Janh Anni
Hello John,

Thank you so much for your kind assistance and the detailed descriptions.
I will play with the scripts and see which one is the easiest that serves
the purpose..

Best regards,
Janh


On Sun, Mar 24, 2013 at 7:50 AM, John Kane  wrote:

> **
> Unless you have a really large number of wells I'd just use the brute
> force approach of reading in each data set with a simple read.table or
> read.csv  like
>
> well1  <-  read.csv("well1.csv) type of statement and repeat for each well.
>
> Here is a simple example that may give you an idea of how to do the
> boxplots . I have done them two ways, one using base graphics and the other
> using ggplot2.  You will probably have to install the ggplot2 package --
> just issue the command install.packages("ggplot2)
>
> The base approach is initially a lot simpler but in the longer term, if
> you expect to do a lot of graphing work in R, the grid packages like
> ggplot2 or lattice seem to offer a lot more control for less actual typing,
> especially if you need publication/report quality graphics.
>
> ##===start code=
> set.seed(345)  #reproducable sample
>   # create three sample data sets,
>   well_1  <-  data.frame(arsenic = rnorm(12))
>   well_2  <-  data.frame (arsenic = rnorm(10))
>   well_3  <-  data.frame (arsenic = rnorm(15))
>
>   wells  <-  rbind(well_1, well_2, well_3)  # create single data.frame
>
>   #create an id value for each well
>   well_id  <- c(rep(1,nrow(well_1)), rep(2, nrow(well_2)), rep(3,
> nrow(well_3)))
>
>   #add the well identifier
>   wells  <-  cbind(wells , well_id)
>   str(wells) # check to see what we have
>
>   boxplot(arsenic ~ well_id, data = wells) # plot vertical boxplot
>   boxplot(arsenic ~ well_id, data = wells,
> horizontal = TRUE,col=c("red","green","blue")) #horizontal box
> plot
>
>   # vertical boxplot using ggplot2
>   library(ggplot2)
>
>   p  <-  ggplot(wells, aes(as.factor(well_id), arsenic)) + geom_boxplot()
>   p
>
>   # horizontal boxplot
>   p1   <-  p + coord_flip()
>   p1
>
>   p2  <-  ggplot(wells, aes(as.factor(well_id), arsenic, fill =
> as.factor(well_id) )) +
> geom_boxplot() + coord_flip() +
>  scale_fill_discrete(guide=FALSE)
>
>
> ##===end code==
>
>
>
> John Kane
> Kingston ON Canada
>
>
> -Original Message-
> *From:* annij...@gmail.com
> *Sent:* Sat, 23 Mar 2013 10:22:02 -0400
> *To:* jrkrid...@inbox.com
> *Subject:* Re: [R] boxplot
>
> Hello John,
>
> I apologize for the delayed response.  Yes I am referring to the same type
> of data in the data sets.  For example, the arsenic concentrations in
> individual groundwater monitoring wells at a groundwater contaminated site,
> where one well may have 12 concentration measurements, another well has 10,
> etc.
>
> Thanks
> Janh
>
>
> On Fri, Mar 22, 2013 at 5:31 PM, John Kane  wrote:
>
> Hi Janh,
>
> When you say that you have "multiple data sets of unequal sample sizes"
> are you speaking of the same kind of data"  For example are you speaking of
> data from a set of experiments where the variables measured are all the
> same and where when you graph them you expect the same x and y scales?
>
> Or are you talking about essentilly independent data sets that it makes
> sense to graph in a grid ?
>
>
> John Kane
> Kingston ON Canada
>
>
> > -Original Message-
> > From: annij...@gmail.com
> > Sent: Fri, 22 Mar 2013 10:46:21 -0400
> > To: dcarl...@tamu.edu
> > Subject: Re: [R] boxplot
> >
> > Hello All,
> >
> > On the subject of boxplots, I have multiple data sets of unequal sample
> > sizes and was wondering what would be the most efficient way to read in
> > the
> > data and plot side-by-side boxplots, with options for controlling the
> > orientation of the plots (i.e. vertical or horizontal) and the spacing?
> > Your
> > assistance is greatly appreciated, but please try to be explicit as I am
> > no
> > R expert.  Thanks
> >
> > Janh
> >
> >
> >
> > On Thu, Mar 21, 2013 at 9:19 AM, David L Carlson 
> > wrote:
> >
> >> Your variable loc_type combines information from two variables (loc and
> >> type). Since you are subsetting on loc, why not just plot by type?
> >>
> >> boxplot(var1~type, data[data$loc=="nice",])
> >>
> >> --
> >> David L Carlson
> >> Associate Professor of Ant

Re: [R] boxplot

2013-03-24 Thread John Kane

   Unless you have a really large number of wells I'd just use the brute force
   approach of reading in each data set with a simple read.table or
   read.csv  like

   well1  <-  read.csv("well1.csv) type of statement and repeat for each well.
   Here is a simple example that may give you an idea of how to do the boxplots
   . I have done them two ways, one using base graphics and the other using
   ggplot2.  You will probably have to install the ggplot2 package -- just
   issue the command install.packages("ggplot2)
   The base approach is initially a lot simpler but in the longer term, if you
   expect to do a lot of graphing work in R, the grid packages like ggplot2 or
   lattice seem to offer a lot more control for less actual typing, especially
   if you need publication/report quality graphics.
   ##===start code=
   set.seed(345)  #reproducable sample
 # create three sample data sets,
 well_1  <-  data.frame(arsenic = rnorm(12))
 well_2  <-  data.frame (arsenic = rnorm(10))
 well_3  <-  data.frame (arsenic = rnorm(15))

 wells  <-  rbind(well_1, well_2, well_3)  # create single data.frame

 #create an id value for each well
  well_id   <-  c(rep(1,nrow(well_1)),  rep(2,  nrow(well_2)), rep(3,
   nrow(well_3)))

 #add the well identifier
 wells  <-  cbind(wells , well_id)
 str(wells) # check to see what we have

 boxplot(arsenic ~ well_id, data = wells) # plot vertical boxplot
 boxplot(arsenic ~ well_id, data = wells,
   horizontal = TRUE,col=c("red","green","blue")) #horizontal box
   plot

 # vertical boxplot using ggplot2
 library(ggplot2)

 p  <-  ggplot(wells, aes(as.factor(well_id), arsenic)) + geom_boxplot()
 p
 # horizontal boxplot
 p1   <-  p + coord_flip()
 p1

  p2   <-   ggplot(wells,  aes(as.factor(well_id),  arsenic,  fill  =
   as.factor(well_id) )) +
   geom_boxplot() + coord_flip() +
scale_fill_discrete(guide=FALSE)

   ##===end code==



   John Kane
   Kingston ON Canada

   -Original Message-
   From: annij...@gmail.com
   Sent: Sat, 23 Mar 2013 10:22:02 -0400
   To: jrkrid...@inbox.com
   Subject: Re: [R] boxplot

   Hello John,

   I apologize for the delayed response.  Yes I am referring to the same type
   of  data in the data sets.  For example, the arsenic concentrations in
   individual groundwater monitoring wells at a groundwater contaminated site,
   where one well may have 12 concentration measurements, another well has 10,
   etc.

   Thanks
   Janh
   On Fri, Mar 22, 2013 at 5:31 PM, John Kane <[1]jrkrid...@inbox.com> wrote:

 Hi Janh,
 When you say that you have "multiple data sets of unequal sample sizes"
 are you speaking of the same kind of data"  For example are you speaking
 of data from a set of experiments where the variables measured are all the
 same and where when you graph them you expect the same x and y scales?
 Or are you talking about essentilly independent data sets that it makes
 sense to graph in a grid ?
 John Kane
 Kingston ON Canada

   > -Original Message-
   > From: [2]annij...@gmail.com
   > Sent: Fri, 22 Mar 2013 10:46:21 -0400
   > To: [3]dcarl...@tamu.edu
   > Subject: Re: [R] boxplot
   >
   > Hello All,
   >
   > On the subject of boxplots, I have multiple data sets of unequal sample
   > sizes and was wondering what would be the most efficient way to read in
   > the
   > data and plot side-by-side boxplots, with options for controlling the
   > orientation of the plots (i.e. vertical or horizontal) and the spacing?
   > Your
   > assistance is greatly appreciated, but please try to be explicit as I am
   > no
   > R expert.  Thanks
   >
   > Janh
   >
   >
   >
   > On Thu, Mar 21, 2013 at 9:19 AM, David L Carlson <[4]dcarl...@tamu.edu>
   > wrote:
   >
   >> Your variable loc_type combines information from two variables (loc and
   >> type). Since you are subsetting on loc, why not just plot by type?
   >>
   >> boxplot(var1~type, data[data$loc=="nice",])
   >>
   >> --
   >> David L Carlson
   >> Associate Professor of Anthropology
   >> Texas A&M University
   >> College Station, TX 77843-4352
   >>
   >>> -Original Message-
   >>> From: [5]r-help-boun...@r-project.org [mailto:[6]r-help-bounces@r-
   >>> [7]project.org] On Behalf Of Jim Lemon
   >>> Sent: Thursday, March 21, 2013 4:05 AM
   >>> To: carol white
   >>> Cc: [8]r-h...@stat.math.ethz.ch
   >>> Subject: Re: [R] boxplot
   >>>
   >>> On 03/21/

Re: [R] boxplot

2013-03-23 Thread Janh Anni
Hello John,

I apologize for the delayed response.  Yes I am referring to the same type
of data in the data sets.  For example, the arsenic concentrations in
individual groundwater monitoring wells at a groundwater contaminated site,
where one well may have 12 concentration measurements, another well has 10,
etc.

Thanks
Janh


On Fri, Mar 22, 2013 at 5:31 PM, John Kane  wrote:

> Hi Janh,
>
> When you say that you have "multiple data sets of unequal sample sizes"
> are you speaking of the same kind of data"  For example are you speaking of
> data from a set of experiments where the variables measured are all the
> same and where when you graph them you expect the same x and y scales?
>
> Or are you talking about essentilly independent data sets that it makes
> sense to graph in a grid ?
>
>
> John Kane
> Kingston ON Canada
>
>
> > -Original Message-
> > From: annij...@gmail.com
> > Sent: Fri, 22 Mar 2013 10:46:21 -0400
> > To: dcarl...@tamu.edu
> > Subject: Re: [R] boxplot
> >
> > Hello All,
> >
> > On the subject of boxplots, I have multiple data sets of unequal sample
> > sizes and was wondering what would be the most efficient way to read in
> > the
> > data and plot side-by-side boxplots, with options for controlling the
> > orientation of the plots (i.e. vertical or horizontal) and the spacing?
> > Your
> > assistance is greatly appreciated, but please try to be explicit as I am
> > no
> > R expert.  Thanks
> >
> > Janh
> >
> >
> >
> > On Thu, Mar 21, 2013 at 9:19 AM, David L Carlson 
> > wrote:
> >
> >> Your variable loc_type combines information from two variables (loc and
> >> type). Since you are subsetting on loc, why not just plot by type?
> >>
> >> boxplot(var1~type, data[data$loc=="nice",])
> >>
> >> --
> >> David L Carlson
> >> Associate Professor of Anthropology
> >> Texas A&M University
> >> College Station, TX 77843-4352
> >>
> >>> -Original Message-
> >>> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> >>> project.org] On Behalf Of Jim Lemon
> >>> Sent: Thursday, March 21, 2013 4:05 AM
> >>> To: carol white
> >>> Cc: r-h...@stat.math.ethz.ch
> >>> Subject: Re: [R] boxplot
> >>>
> >>> On 03/21/2013 07:40 PM, carol white wrote:
> >>>> Hi,
> >>>> It must be an easy question but how to boxplot a subset of data:
> >>>>
> >>>> data = read.table("my_data.txt", header = T)
> >>>> boxplot(data$var1[data$loc == "nice"]~data$loc_type[data$loc ==
> >>> "nice"])
> >>>> #in this case, i want to display only the boxplot loc == "nice"
> >>>> #doesn't display the boxplot of only loc == "nice". It also displays
> >>> loc == "mice"
> >>>>
> >>> Hi Carol,
> >>> It's them old factors sneakin' up on you. Try this:
> >>>
> >>> boxplot(data$var1[data$loc == "nice"]~
> >>>   as.character(data$loc_type[data$loc == "nice"]))
> >>>
> >>> Jim
> >>>
> >>> __
> >>> R-help@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.
> >>
> >> __
> >> R-help@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.
> >>
> >
> >   [[alternative HTML version deleted]]
> >
> > __
> > R-help@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.
>
> 
> FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!
> Check it out at http://www.inbox.com/earth
>
>
>

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] boxplot

2013-03-22 Thread Robert Baer
On the subject of boxplots, I have multiple data sets of unequal sample 
sizes and was wondering what would be the most efficient way to read in 
the data and plot side-by-side boxplots, with options for controlling 
the orientation of the plots (i.e. vertical or horizontal) and the 
spacing? Your assistance is greatly appreciated, but please try to be 
explicit as I am no R expert.


Thanks Janh

Not sure without a reproducible example (please read posting guide) but 
maybe this will help:


a = sample(1:100, 30)
b = sample(1:100, 50)
c = sample(50:100,19)
d = sample(1:50, 15)
e = sample(1:50, 15)
f = sample(1:50, 25)

x11(width = 7, height = 3.5)
op =par(mfrow = c(1,2))  # plot side by side

# horizontal
boxplot(list(a,b,c), horizontal = TRUE, main = 'Horizontal',
xlim = c(0,9), names = c('a', 'b','c'))
boxplot(list(e, f), horizontal = TRUE, xlim = c(0,9), names = c('e', 'f'),
at = c(7,8), add = TRUE, col ='red')

# vertical
boxplot(list(a,b,c), horizontal = FALSE, xlim = c(0,9), main = 'Verticalal',
 names = c('a', 'b','c'))
boxplot(list(e, f), horizontal = FALSE, xlim = c(0,9), names = c('e', 'f'),
at = c(7,8), add = TRUE, col ='red')
par(op)

Cheers,

Rob



___
 Robert W. Baer, Ph.D.
Professor of Physiology
Kirksille College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501 USA

__
R-help@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.


Re: [R] boxplot

2013-03-22 Thread John Kane
Hi Janh,

When you say that you have "multiple data sets of unequal sample sizes" are you 
speaking of the same kind of data"  For example are you speaking of data from a 
set of experiments where the variables measured are all the same and where when 
you graph them you expect the same x and y scales? 

Or are you talking about essentilly independent data sets that it makes sense 
to graph in a grid ?  


John Kane
Kingston ON Canada


> -Original Message-
> From: annij...@gmail.com
> Sent: Fri, 22 Mar 2013 10:46:21 -0400
> To: dcarl...@tamu.edu
> Subject: Re: [R] boxplot
> 
> Hello All,
> 
> On the subject of boxplots, I have multiple data sets of unequal sample
> sizes and was wondering what would be the most efficient way to read in
> the
> data and plot side-by-side boxplots, with options for controlling the
> orientation of the plots (i.e. vertical or horizontal) and the spacing?
> Your
> assistance is greatly appreciated, but please try to be explicit as I am
> no
> R expert.  Thanks
> 
> Janh
> 
> 
> 
> On Thu, Mar 21, 2013 at 9:19 AM, David L Carlson 
> wrote:
> 
>> Your variable loc_type combines information from two variables (loc and
>> type). Since you are subsetting on loc, why not just plot by type?
>> 
>> boxplot(var1~type, data[data$loc=="nice",])
>> 
>> --
>> David L Carlson
>> Associate Professor of Anthropology
>> Texas A&M University
>> College Station, TX 77843-4352
>> 
>>> -Original Message-
>>> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
>>> project.org] On Behalf Of Jim Lemon
>>> Sent: Thursday, March 21, 2013 4:05 AM
>>> To: carol white
>>> Cc: r-h...@stat.math.ethz.ch
>>> Subject: Re: [R] boxplot
>>> 
>>> On 03/21/2013 07:40 PM, carol white wrote:
>>>> Hi,
>>>> It must be an easy question but how to boxplot a subset of data:
>>>> 
>>>> data = read.table("my_data.txt", header = T)
>>>> boxplot(data$var1[data$loc == "nice"]~data$loc_type[data$loc ==
>>> "nice"])
>>>> #in this case, i want to display only the boxplot loc == "nice"
>>>> #doesn't display the boxplot of only loc == "nice". It also displays
>>> loc == "mice"
>>>> 
>>> Hi Carol,
>>> It's them old factors sneakin' up on you. Try this:
>>> 
>>> boxplot(data$var1[data$loc == "nice"]~
>>>   as.character(data$loc_type[data$loc == "nice"]))
>>> 
>>> Jim
>>> 
>>> __
>>> R-help@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.
>> 
>> __
>> R-help@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.
>> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@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.


FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!

__
R-help@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.


Re: [R] boxplot

2013-03-22 Thread Janh Anni
Hello All,

On the subject of boxplots, I have multiple data sets of unequal sample
sizes and was wondering what would be the most efficient way to read in the
data and plot side-by-side boxplots, with options for controlling the
orientation of the plots (i.e. vertical or horizontal) and the spacing?   Your
assistance is greatly appreciated, but please try to be explicit as I am no
R expert.  Thanks

Janh



On Thu, Mar 21, 2013 at 9:19 AM, David L Carlson  wrote:

> Your variable loc_type combines information from two variables (loc and
> type). Since you are subsetting on loc, why not just plot by type?
>
> boxplot(var1~type, data[data$loc=="nice",])
>
> --
> David L Carlson
> Associate Professor of Anthropology
> Texas A&M University
> College Station, TX 77843-4352
>
> > -Original Message-
> > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> > project.org] On Behalf Of Jim Lemon
> > Sent: Thursday, March 21, 2013 4:05 AM
> > To: carol white
> > Cc: r-h...@stat.math.ethz.ch
> > Subject: Re: [R] boxplot
> >
> > On 03/21/2013 07:40 PM, carol white wrote:
> > > Hi,
> > > It must be an easy question but how to boxplot a subset of data:
> > >
> > > data = read.table("my_data.txt", header = T)
> > > boxplot(data$var1[data$loc == "nice"]~data$loc_type[data$loc ==
> > "nice"])
> > > #in this case, i want to display only the boxplot loc == "nice"
> > > #doesn't display the boxplot of only loc == "nice". It also displays
> > loc == "mice"
> > >
> > Hi Carol,
> > It's them old factors sneakin' up on you. Try this:
> >
> > boxplot(data$var1[data$loc == "nice"]~
> >   as.character(data$loc_type[data$loc == "nice"]))
> >
> > Jim
> >
> > __
> > R-help@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.
>
> __
> R-help@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.
>

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] boxplot

2013-03-21 Thread David L Carlson
Your variable loc_type combines information from two variables (loc and
type). Since you are subsetting on loc, why not just plot by type?

boxplot(var1~type, data[data$loc=="nice",])

--
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352

> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Jim Lemon
> Sent: Thursday, March 21, 2013 4:05 AM
> To: carol white
> Cc: r-h...@stat.math.ethz.ch
> Subject: Re: [R] boxplot
> 
> On 03/21/2013 07:40 PM, carol white wrote:
> > Hi,
> > It must be an easy question but how to boxplot a subset of data:
> >
> > data = read.table("my_data.txt", header = T)
> > boxplot(data$var1[data$loc == "nice"]~data$loc_type[data$loc ==
> "nice"])
> > #in this case, i want to display only the boxplot loc == "nice"
> > #doesn't display the boxplot of only loc == "nice". It also displays
> loc == "mice"
> >
> Hi Carol,
> It's them old factors sneakin' up on you. Try this:
> 
> boxplot(data$var1[data$loc == "nice"]~
>   as.character(data$loc_type[data$loc == "nice"]))
> 
> Jim
> 
> __
> R-help@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.

__
R-help@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.


Re: [R] boxplot

2013-03-21 Thread Jim Lemon

On 03/21/2013 07:40 PM, carol white wrote:

Hi,
It must be an easy question but how to boxplot a subset of data:

data = read.table("my_data.txt", header = T)
boxplot(data$var1[data$loc == "nice"]~data$loc_type[data$loc == "nice"])
#in this case, i want to display only the boxplot loc == "nice"
#doesn't display the boxplot of only loc == "nice". It also displays loc == 
"mice"


Hi Carol,
It's them old factors sneakin' up on you. Try this:

boxplot(data$var1[data$loc == "nice"]~
 as.character(data$loc_type[data$loc == "nice"]))

Jim

__
R-help@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.


Re: [R] boxplot

2013-03-14 Thread Marc Girondot

v <- c(V1=2, V2=4 ,V3=6 ,V4=7 ,V5=12 ,V6=33 ,V7=43 ,V8=53)
boxplot(v[seq(from=1, to=8, by=2)], v[seq(from=2, to=8, by=2)])

Sincerely
Marc

Le 13/03/13 23:14, wei wu a écrit :

Hi,

I try to boxplot following data on the subset of (V1,V3,V5,V7) and 
(V2,V4,V6,V8)


V1  V2   V3 V4  V5  V6  V7  V8
24  6 712  33   43  53

how can I use boxplot function to plot it?

thanks,

William

__
R-help@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.




--
__
Marc Girondot, Pr

Laboratoire Ecologie, Systématique et Evolution
Equipe de Conservation des Populations et des Communautés
CNRS, AgroParisTech et Université Paris-Sud 11 , UMR 8079
Bâtiment 362
91405 Orsay Cedex, France

Tel:  33 1 (0)1.69.15.72.30   Fax: 33 1 (0)1.69.15.73.53
e-mail: marc.giron...@u-psud.fr
Web: http://www.ese.u-psud.fr/epc/conservation/Marc.html
Skype: girondot

__
R-help@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.


Re: [R] boxplot with frequencies(counts)

2013-03-06 Thread Jim Lemon

On 03/06/2013 12:45 AM, km wrote:

Dear All,

I have a table as following
position type count
1   2 100
1   3  51
1   5  64
1   8  81
1   6  32
2   2  41
2   3  85
and so on


Normally if  would have a vector of 2,3,4,5... by position position and
plot them by position.
But now i have counts of these types.
Is there a way to compute boxplot of such kind of data ?


Hi KM,
We must assume that the "type" variable is to be used as a value, 
otherwise you would want something like a frequency plot by two factors 
of position and type. (If this is the case, I would suggest a nested bar 
plot). Here is a fairly awful kludge that will get you a boxplot (tdf is 
your "table"):


reprow<-function(x) return(matrix(rep(x[1:2],x[3]),ncol=2,byrow=TRUE))
replist<-apply(as.matrix(tdf),1,reprow)
repmat<-replist[[1]]
for(rep in 1:length(replist)) repmat<-rbind(repmat,replist[[rep]])
boxplot(repmat[,2],repmat[,1])

With apologies
Jim

__
R-help@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.


Re: [R] Boxplot Issues

2013-02-10 Thread John Kane
Nice boxplot but you forgot to tell us the issues  :)

John Kane
Kingston ON Canada


> -Original Message-
> From: asir...@gmail.com
> Sent: Sat, 9 Feb 2013 08:09:13 -0800
> To: r-help@r-project.org
> Subject: [R] Boxplot Issues
> 
> __
> R-help@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.


FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
family!
Visit http://www.inbox.com/photosharing to find out more!

__
R-help@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.


Re: [R] Boxplot in R

2012-11-16 Thread Rolf Turner

On 17/11/12 09:04, Elli wrote:

How to calculate the boxplots R? This question arises because we are building
manually boxplots, we consulted various literature sources for calculations
of the boxplot but our results differ from those generated by R, especially
when calculating the whiskers.
What is the procedure used by R to perform these calculations?
Anyone can help us please?


?boxplot.stats

cheers,

Rolf Turner

__
R-help@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.


Re: [R] Boxplot in R

2012-11-16 Thread Marc Schwartz
On Nov 16, 2012, at 2:04 PM, Elli  wrote:

> How to calculate the boxplots R? This question arises because we are building
> manually boxplots, we consulted various literature sources for calculations
> of the boxplot but our results differ from those generated by R, especially
> when calculating the whiskers.
> What is the procedure used by R to perform these calculations?
> Anyone can help us please?



A reading of the help page for the function using ?boxplot would be 
enlightening, taking note of the 'range' argument relative to the whiskers, 
which defaults to 1.5.

The See Also on that help page points you to ?boxplot.stats "which does the 
computation" and has additional detail. Both pages list references.

If all else fails, since R is open source, you can always look at the source 
code for both functions to follow exactly what is done.

Regards,

Marc Schwartz

__
R-help@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.


Re: [R] boxplot of different colors

2012-09-26 Thread John Kane
Shamelessly stealling Richard Heiberger's data set I'd suggest another way 
using ggplot2 which you would need to install

library(ggplot2)

dataN <- data.frame(GE_distance=rnorm(260),
Diet_B=factor(rep(1:13, each=20)))

p  <-  ggplot(dataN , aes(Diet_B, GE_distance, colour = Diet_B  )) + 
geom_boxplot() +
   xlab("Migration") + ylab("Distance")
p 


John Kane
Kingston ON Canada


> -Original Message-
> From: r...@temple.edu
> Sent: Mon, 24 Sep 2012 19:00:09 -0400
> To: elaine.kuo...@gmail.com
> Subject: Re: [R] boxplot of different colors
> 
> ## I would do this in lattice using the panel.bwplot.intermediate.hh
> ## function from the HH package.
> 
> ## install.packages("HH") ## if necessary
> library(HH)
> 
> dataN <- data.frame(GE_distance=rnorm(260),
> Diet_B=factor(rep(1:13, each=20)))
> Diet.colors <- c("forestgreen", "darkgreen","chocolate1","darkorange2",
>  "sienna2","red2","firebrick3","saddlebrown","coral4",
>  "chocolate4","darkblue","navy","grey38")
> bwplot(GE_distance ~ Diet_B, data=dataN,
>xlab=list("Diet of Breeding Ground", cex = 1.4),
>ylab = list(
>  "Distance between Centers of B and NB Range (1000 km)",
>  cex = 1.4),
>panel=panel.bwplot.intermediate.hh,
>col=Diet.colors,
>pch=rep("|",13))
> 
> 
> On Mon, Sep 24, 2012 at 6:23 PM, Elaine Kuo 
> wrote:
> 
>> Hello,
>> 
>> I am making a boxplot of 13 boxes.
>> I tried to color the box using 13 colors but failed.
>> Only red and brown were displayed.
>> Green, blue, and grey disappeared.
>> 
>> Please kindly advise modification after checking the code below.
>> Thank you in advance.
>> 
>> Elaine
>> 
>> R code
>> # data input
>> dataN
>> 
>> <-read.csv("H:/a_mig_distance_B_NB/R_data/Mig_bird_586_20120925.csv",header=T,
>> row.names=1)
>> dim(dataN)
>> dataN[1,]
>> str(dataN)
>> 
>>   # graph
>> par(mai=c(1,1.03,0.4,0.4))
>> 
>> obs.group<-dataN$Diet_B
>> 
>> par(new=T)
>> 
>> boxplot(GE_distance~Diet_B, data=dataN,xlab="Diet  of  Breeding
>>  Ground",ylab="",
>> yaxt="n",type="p",
>> pch=1,lwd=0.95,
>> cex.lab=1.4, cex.axis=1.2,
>> font.axis=2,
>> cex=1.5,
>> las=1,
>> bty="l",
>> col=c("forestgreen",
>> "darkgreen","chocolate1","darkorange2","sienna2",
>> "red2","firebrick3",
>> 
>> 
>> "saddlebrown","coral4","chocolate4","darkblue","navy","grey38")[obs.group]))
>> 
>> op = par(mar = c(5,5,4,2) + 0.1)
>> title(ylab = "Distance between Centers of B and NB Range (1000 km)",
>> cex.lab = 1.4,line = 3)
>> 
>> axis(side=2,yaxp=c(0,2,4),cex.lab=1.4, cex.axis=1.2,font.axis=2,
>> las=1)
>> 
>> [[alternative HTML version deleted]]
>> 
>> __
>> R-help@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.
>> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@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.


Send any screenshot to your friends in seconds...
Works in all emails, instant messengers, blogs, forums and social networks.
TRY IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if2 for FREE

__
R-help@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.


Re: [R] boxplot of different colors

2012-09-25 Thread Elaine Kuo
hello Richard,

Thank a lot.
The plot is breathtaking.

I would like to make three modifications.
Please kindly help and thanks.

1. making outliers from dash to empty circle (pch=2)
I tried plot.symbol as the code below but failed.

2. making font size of axis (levels) larger to 1.2
unsure where to adjust in the code

3. making levels along x-axis horizontal instead of vertical
unsure where to adjust in the code.

Elaine

Code

dataN <- data.frame(GE_distance=rnorm(260),

Diet_B=factor(rep(1:13, each=20)))

Diet.colors <- c("forestgreen", "darkgreen","chocolate1","darkorange2",

 "sienna2","red2","firebrick3","saddlebrown","coral4",

 "chocolate4","darkblue","navy","grey38")

levels(dataN$Diet_B) <- Diet.colors

diet = list(lty=1,pch=1)

bwplot(GE_distance ~ Diet_B, data=dataN,

   xlab=list("Diet of Breeding Ground", cex = 1.4),

   ylab = list(

 "Distance between Centers of B and NB Range (1000 km)",

 cex = 1.4),

   panel=panel.bwplot.intermediate.hh,

   col=Diet.colors,

   pch=rep("|",13),

   scales=list(x=list(rot=90)),

   par.settings=list(box.umbrella=diet,plot.symbol = diet))




On Tue, Sep 25, 2012 at 11:48 AM, Richard M. Heiberger wrote:

> See ?panel.bwplot for pch="|".
> That explains that pch="|" puts horizontal lines instead of dots at the
> median(and also at the
> outliers).
> The rep makes it into a vector to be indexed by
> panel.bwplot.intermediate.hh
> in each of its calls to panel.bwplot
>
> The names under each plot are the levels of the factor, in this example
> levels(Diet_B).
> You called them 1:13 in your example.  If you want to give them names do
> so as a factor.
> For example
>
> Control the staples with box.umbrella, again see ?panel.bwplot and
> ?trellis.par.get
>
> The revised example here does all three of your requests.
>
> dataN <- data.frame(GE_distance=rnorm(260),
> Diet_B=factor(rep(1:13, each=20)))
> Diet.colors <- c("forestgreen", "darkgreen","chocolate1","darkorange2",
>  "sienna2","red2","firebrick3","saddlebrown","coral4",
>  "chocolate4","darkblue","navy","grey38")
> levels(dataN$Diet_B) <- Diet.colors
> bwplot(GE_distance ~ Diet_B, data=dataN,
>xlab=list("Diet of Breeding Ground", cex = 1.4),
>ylab = list(
>  "Distance between Centers of B and NB Range (1000 km)",
>  cex = 1.4),
>panel=panel.bwplot.intermediate.hh,
>col=Diet.colors,
>pch=rep("|",13),
>scales=list(x=list(rot=90)),
>par.settings=list(box.umbrella=list(lty=1)))
>
>
> On Mon, Sep 24, 2012 at 11:13 PM, Elaine Kuo wrote:
>
>> Hello Richard,
>>
>> Your answer is a great help to my problem.
>> The boxplot of 13 colors is very beautiful :)
>>
>> By the way, I have three subsequent questions of your code
>>
>> 1. the meaning of  pch=rep("|",13)
>> I read the R manual but could not interpret the part.
>> "pch" means the point type in plot, but here not sure.
>>
>> 2. how to write names under each box
>> In boxplot, "names" can explain each box,
>> but here "names" does not work.
>>
>> 3. how to make staple from dash to solid line
>>
>> Thanks again
>>
>> Elaine
>>
>> On Tue, Sep 25, 2012 at 7:00 AM, Richard M. Heiberger wrote:
>>
>>> ## I would do this in lattice using the panel.bwplot.intermediate.hh
>>> ## function from the HH package.
>>>
>>> ## install.packages("HH") ## if necessary
>>> library(HH)
>>>
>>> dataN <- data.frame(GE_distance=rnorm(260),
>>> Diet_B=factor(rep(1:13, each=20)))
>>> Diet.colors <- c("forestgreen", "darkgreen","chocolate1","darkorange2",
>>>   "sienna2","red2","firebrick3","saddlebrown","coral4",
>>>  "chocolate4","darkblue","navy","grey38")
>>> bwplot(GE_distance ~ Diet_B, data=dataN,
>>>xlab=list("Diet of Breeding Ground", cex = 1.4),
>>>ylab = list(
>>>  "Distance between Centers of B and NB Range (1000 km)",
>>>  cex = 1.4),
>>>panel=panel.bwplot.intermediate.hh,
>>>col=Diet.colors,
>>>pch=rep("|",13))
>>>
>>>
>>> On Mon, Sep 24, 2012 at 6:23 PM, Elaine Kuo wrote:
>>>
 Hello,

 I am making a boxplot of 13 boxes.
 I tried to color the box using 13 colors but failed.
 Only red and brown were displayed.
 Green, blue, and grey disappeared.

 Please kindly advise modification after checking the code below.
 Thank you in advance.

 Elaine

 R code
 # data input
 dataN

 <-read.csv("H:/a_mig_distance_B_NB/R_data/Mig_bird_586_20120925.csv",header=T,
 row.names=1)
 dim(dataN)
 dataN[1,]
 str(dataN)

   # graph
 par(mai=c(1,1.03,0.4,0.4))

 obs.group<-dataN$Diet_B

 par(new=T)

 boxplot(GE_distance~Diet_B, data=dataN,xlab="Diet  of  Breeding
  Ground",ylab="",
 yaxt="n",type="p",
 pch

Re: [R] boxplot names italic

2012-09-25 Thread Jim Lemon

On 09/25/2012 06:08 PM, Wolf Sarah wrote:

Hello

I have two boxplots and want the names to be in italic, which works fine, 
except that the second name (Sinapis) is raised, compared to the first name:

bicran<-c(0.55,0.25,0.6,0.83,0.11,0,0.67,1.36,0.9,1.09)
bicsin<-c(0.09,0.53,0.45,0.38,1.18,0.45,0.78,1.17,1.22,1.4)
ran.text<-expression(italic(Ranunculus))
sin.text<-expression(italic(Sinapis))
boxplot(bicran, bicsin, names=c(ran.text, sin.text))
mtext("(N=10)", side=1,line=1, adj=0.43,cex=0.9)
mtext("(N=10)",side=1,line=1,adj=0.9, cex=0.9)


Is there anything I can do against that? With the names in regular letters 
there is no problem, the names show up on the same level:

boxplot(bicran, bicsin, names=c("Ranunculus", "Sinapis"))


Hi Sarah,
Try this:

boxplot(bicran, bicsin, names=c("",""))
mtext(c(ran.text,sin.text),at=1:2,line=c(0.9,1),side=1)

That looks about right, but you can fiddle with it.

Jim

__
R-help@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.


Re: [R] boxplot of different colors

2012-09-24 Thread Richard M. Heiberger
See ?panel.bwplot for pch="|".
That explains that pch="|" puts horizontal lines instead of dots at the
median(and also at the
outliers).
The rep makes it into a vector to be indexed by panel.bwplot.intermediate.hh
in each of its calls to panel.bwplot

The names under each plot are the levels of the factor, in this example
levels(Diet_B).
You called them 1:13 in your example.  If you want to give them names do so
as a factor.
For example

Control the staples with box.umbrella, again see ?panel.bwplot and
?trellis.par.get

The revised example here does all three of your requests.

dataN <- data.frame(GE_distance=rnorm(260),
Diet_B=factor(rep(1:13, each=20)))
Diet.colors <- c("forestgreen", "darkgreen","chocolate1","darkorange2",
 "sienna2","red2","firebrick3","saddlebrown","coral4",
 "chocolate4","darkblue","navy","grey38")
levels(dataN$Diet_B) <- Diet.colors
bwplot(GE_distance ~ Diet_B, data=dataN,
   xlab=list("Diet of Breeding Ground", cex = 1.4),
   ylab = list(
 "Distance between Centers of B and NB Range (1000 km)",
 cex = 1.4),
   panel=panel.bwplot.intermediate.hh,
   col=Diet.colors,
   pch=rep("|",13),
   scales=list(x=list(rot=90)),
   par.settings=list(box.umbrella=list(lty=1)))


On Mon, Sep 24, 2012 at 11:13 PM, Elaine Kuo wrote:

> Hello Richard,
>
> Your answer is a great help to my problem.
> The boxplot of 13 colors is very beautiful :)
>
> By the way, I have three subsequent questions of your code
>
> 1. the meaning of  pch=rep("|",13)
> I read the R manual but could not interpret the part.
> "pch" means the point type in plot, but here not sure.
>
> 2. how to write names under each box
> In boxplot, "names" can explain each box,
> but here "names" does not work.
>
> 3. how to make staple from dash to solid line
>
> Thanks again
>
> Elaine
>
> On Tue, Sep 25, 2012 at 7:00 AM, Richard M. Heiberger wrote:
>
>> ## I would do this in lattice using the panel.bwplot.intermediate.hh
>> ## function from the HH package.
>>
>> ## install.packages("HH") ## if necessary
>> library(HH)
>>
>> dataN <- data.frame(GE_distance=rnorm(260),
>> Diet_B=factor(rep(1:13, each=20)))
>> Diet.colors <- c("forestgreen", "darkgreen","chocolate1","darkorange2",
>>   "sienna2","red2","firebrick3","saddlebrown","coral4",
>>  "chocolate4","darkblue","navy","grey38")
>> bwplot(GE_distance ~ Diet_B, data=dataN,
>>xlab=list("Diet of Breeding Ground", cex = 1.4),
>>ylab = list(
>>  "Distance between Centers of B and NB Range (1000 km)",
>>  cex = 1.4),
>>panel=panel.bwplot.intermediate.hh,
>>col=Diet.colors,
>>pch=rep("|",13))
>>
>>
>> On Mon, Sep 24, 2012 at 6:23 PM, Elaine Kuo wrote:
>>
>>> Hello,
>>>
>>> I am making a boxplot of 13 boxes.
>>> I tried to color the box using 13 colors but failed.
>>> Only red and brown were displayed.
>>> Green, blue, and grey disappeared.
>>>
>>> Please kindly advise modification after checking the code below.
>>> Thank you in advance.
>>>
>>> Elaine
>>>
>>> R code
>>> # data input
>>> dataN
>>>
>>> <-read.csv("H:/a_mig_distance_B_NB/R_data/Mig_bird_586_20120925.csv",header=T,
>>> row.names=1)
>>> dim(dataN)
>>> dataN[1,]
>>> str(dataN)
>>>
>>>   # graph
>>> par(mai=c(1,1.03,0.4,0.4))
>>>
>>> obs.group<-dataN$Diet_B
>>>
>>> par(new=T)
>>>
>>> boxplot(GE_distance~Diet_B, data=dataN,xlab="Diet  of  Breeding
>>>  Ground",ylab="",
>>> yaxt="n",type="p",
>>> pch=1,lwd=0.95,
>>> cex.lab=1.4, cex.axis=1.2,
>>> font.axis=2,
>>> cex=1.5,
>>> las=1,
>>> bty="l",
>>> col=c("forestgreen",
>>> "darkgreen","chocolate1","darkorange2","sienna2",
>>> "red2","firebrick3",
>>>
>>>
>>> "saddlebrown","coral4","chocolate4","darkblue","navy","grey38")[obs.group]))
>>>
>>> op = par(mar = c(5,5,4,2) + 0.1)
>>> title(ylab = "Distance between Centers of B and NB Range (1000 km)",
>>> cex.lab = 1.4,line = 3)
>>>
>>> axis(side=2,yaxp=c(0,2,4),cex.lab=1.4, cex.axis=1.2,font.axis=2,
>>> las=1)
>>>
>>> [[alternative HTML version deleted]]
>>>
>>> __
>>> R-help@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.
>>>
>>
>>
>

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] boxplot of different colors

2012-09-24 Thread Elaine Kuo
Hello Sarah,

Thanks for the suggestion of
table(obs.group).

I checked it and found no problems of the obs.group.

As for using dput(),
please kindly share some examples to display the colored graph in r-help.
In fact, some colors were assigned to all types of diets, like
A=>red1
B=>red2
C=>green1
D=>green4
E=>darkgreen
F=>orange3
G=>darkorange2
H=>navy
I=>blue1

However, the boxplot displays as
A=>red1
B=>red2
C=>green1
D=>green4
E=>red1
F=>red2
G=>green1
H=>green4
I=>red1.

I am wondering if there is any bug in showing too many colors for boxplot.

Elaine


On Tue, Sep 25, 2012 at 6:52 AM, Sarah Goslee wrote:

> Hi Elaine,
>
> Without a reproducible example it's impossible to say, but I'd take a
> hard look at:
> table(obs.group)
>
> If that doesn't give you some insight, a small reproducible example
> included in your email using dput() would allow us to answer you more
> effectively.
>
> Sarah
>
>
> On Mon, Sep 24, 2012 at 6:23 PM, Elaine Kuo 
> wrote:
> > Hello,
> >
> > I am making a boxplot of 13 boxes.
> > I tried to color the box using 13 colors but failed.
> > Only red and brown were displayed.
> > Green, blue, and grey disappeared.
> >
> > Please kindly advise modification after checking the code below.
> > Thank you in advance.
> >
> > Elaine
> >
> > R code
> > # data input
> > dataN
> >
> <-read.csv("H:/a_mig_distance_B_NB/R_data/Mig_bird_586_20120925.csv",header=T,
> > row.names=1)
> > dim(dataN)
> > dataN[1,]
> > str(dataN)
> >
> >   # graph
> > par(mai=c(1,1.03,0.4,0.4))
> >
> > obs.group<-dataN$Diet_B
> >
> > par(new=T)
> >
> > boxplot(GE_distance~Diet_B, data=dataN,xlab="Diet  of  Breeding
> >  Ground",ylab="",
> > yaxt="n",type="p",
> > pch=1,lwd=0.95,
> > cex.lab=1.4, cex.axis=1.2,
> > font.axis=2,
> > cex=1.5,
> > las=1,
> > bty="l",
> > col=c("forestgreen",
> "darkgreen","chocolate1","darkorange2","sienna2",
> > "red2","firebrick3",
> >
> >
> "saddlebrown","coral4","chocolate4","darkblue","navy","grey38")[obs.group]))
> >
> > op = par(mar = c(5,5,4,2) + 0.1)
> > title(ylab = "Distance between Centers of B and NB Range (1000 km)",
> > cex.lab = 1.4,line = 3)
> >
> > axis(side=2,yaxp=c(0,2,4),cex.lab=1.4, cex.axis=1.2,font.axis=2,
> > las=1)
>
> --
> Sarah Goslee
> http://www.functionaldiversity.org
>

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] boxplot of different colors

2012-09-24 Thread Elaine Kuo
Hello Richard,

Your answer is a great help to my problem.
The boxplot of 13 colors is very beautiful :)

By the way, I have three subsequent questions of your code

1. the meaning of  pch=rep("|",13)
I read the R manual but could not interpret the part.
"pch" means the point type in plot, but here not sure.

2. how to write names under each box
In boxplot, "names" can explain each box,
but here "names" does not work.

3. how to make staple from dash to solid line

Thanks again

Elaine

On Tue, Sep 25, 2012 at 7:00 AM, Richard M. Heiberger wrote:

> ## I would do this in lattice using the panel.bwplot.intermediate.hh
> ## function from the HH package.
>
> ## install.packages("HH") ## if necessary
> library(HH)
>
> dataN <- data.frame(GE_distance=rnorm(260),
> Diet_B=factor(rep(1:13, each=20)))
> Diet.colors <- c("forestgreen", "darkgreen","chocolate1","darkorange2",
>  "sienna2","red2","firebrick3","saddlebrown","coral4",
>  "chocolate4","darkblue","navy","grey38")
> bwplot(GE_distance ~ Diet_B, data=dataN,
>xlab=list("Diet of Breeding Ground", cex = 1.4),
>ylab = list(
>  "Distance between Centers of B and NB Range (1000 km)",
>  cex = 1.4),
>panel=panel.bwplot.intermediate.hh,
>col=Diet.colors,
>pch=rep("|",13))
>
>
> On Mon, Sep 24, 2012 at 6:23 PM, Elaine Kuo wrote:
>
>> Hello,
>>
>> I am making a boxplot of 13 boxes.
>> I tried to color the box using 13 colors but failed.
>> Only red and brown were displayed.
>> Green, blue, and grey disappeared.
>>
>> Please kindly advise modification after checking the code below.
>> Thank you in advance.
>>
>> Elaine
>>
>> R code
>> # data input
>> dataN
>>
>> <-read.csv("H:/a_mig_distance_B_NB/R_data/Mig_bird_586_20120925.csv",header=T,
>> row.names=1)
>> dim(dataN)
>> dataN[1,]
>> str(dataN)
>>
>>   # graph
>> par(mai=c(1,1.03,0.4,0.4))
>>
>> obs.group<-dataN$Diet_B
>>
>> par(new=T)
>>
>> boxplot(GE_distance~Diet_B, data=dataN,xlab="Diet  of  Breeding
>>  Ground",ylab="",
>> yaxt="n",type="p",
>> pch=1,lwd=0.95,
>> cex.lab=1.4, cex.axis=1.2,
>> font.axis=2,
>> cex=1.5,
>> las=1,
>> bty="l",
>> col=c("forestgreen", "darkgreen","chocolate1","darkorange2","sienna2",
>> "red2","firebrick3",
>>
>>
>> "saddlebrown","coral4","chocolate4","darkblue","navy","grey38")[obs.group]))
>>
>> op = par(mar = c(5,5,4,2) + 0.1)
>> title(ylab = "Distance between Centers of B and NB Range (1000 km)",
>> cex.lab = 1.4,line = 3)
>>
>> axis(side=2,yaxp=c(0,2,4),cex.lab=1.4, cex.axis=1.2,font.axis=2,
>> las=1)
>>
>> [[alternative HTML version deleted]]
>>
>> __
>> R-help@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.
>>
>
>

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] boxplot of different colors

2012-09-24 Thread Richard M. Heiberger
## I would do this in lattice using the panel.bwplot.intermediate.hh
## function from the HH package.

## install.packages("HH") ## if necessary
library(HH)

dataN <- data.frame(GE_distance=rnorm(260),
Diet_B=factor(rep(1:13, each=20)))
Diet.colors <- c("forestgreen", "darkgreen","chocolate1","darkorange2",
 "sienna2","red2","firebrick3","saddlebrown","coral4",
 "chocolate4","darkblue","navy","grey38")
bwplot(GE_distance ~ Diet_B, data=dataN,
   xlab=list("Diet of Breeding Ground", cex = 1.4),
   ylab = list(
 "Distance between Centers of B and NB Range (1000 km)",
 cex = 1.4),
   panel=panel.bwplot.intermediate.hh,
   col=Diet.colors,
   pch=rep("|",13))


On Mon, Sep 24, 2012 at 6:23 PM, Elaine Kuo  wrote:

> Hello,
>
> I am making a boxplot of 13 boxes.
> I tried to color the box using 13 colors but failed.
> Only red and brown were displayed.
> Green, blue, and grey disappeared.
>
> Please kindly advise modification after checking the code below.
> Thank you in advance.
>
> Elaine
>
> R code
> # data input
> dataN
>
> <-read.csv("H:/a_mig_distance_B_NB/R_data/Mig_bird_586_20120925.csv",header=T,
> row.names=1)
> dim(dataN)
> dataN[1,]
> str(dataN)
>
>   # graph
> par(mai=c(1,1.03,0.4,0.4))
>
> obs.group<-dataN$Diet_B
>
> par(new=T)
>
> boxplot(GE_distance~Diet_B, data=dataN,xlab="Diet  of  Breeding
>  Ground",ylab="",
> yaxt="n",type="p",
> pch=1,lwd=0.95,
> cex.lab=1.4, cex.axis=1.2,
> font.axis=2,
> cex=1.5,
> las=1,
> bty="l",
> col=c("forestgreen", "darkgreen","chocolate1","darkorange2","sienna2",
> "red2","firebrick3",
>
>
> "saddlebrown","coral4","chocolate4","darkblue","navy","grey38")[obs.group]))
>
> op = par(mar = c(5,5,4,2) + 0.1)
> title(ylab = "Distance between Centers of B and NB Range (1000 km)",
> cex.lab = 1.4,line = 3)
>
> axis(side=2,yaxp=c(0,2,4),cex.lab=1.4, cex.axis=1.2,font.axis=2,
> las=1)
>
> [[alternative HTML version deleted]]
>
> __
> R-help@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.
>

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] boxplot of different colors

2012-09-24 Thread Sarah Goslee
Hi Elaine,

Without a reproducible example it's impossible to say, but I'd take a
hard look at:
table(obs.group)

If that doesn't give you some insight, a small reproducible example
included in your email using dput() would allow us to answer you more
effectively.

Sarah


On Mon, Sep 24, 2012 at 6:23 PM, Elaine Kuo  wrote:
> Hello,
>
> I am making a boxplot of 13 boxes.
> I tried to color the box using 13 colors but failed.
> Only red and brown were displayed.
> Green, blue, and grey disappeared.
>
> Please kindly advise modification after checking the code below.
> Thank you in advance.
>
> Elaine
>
> R code
> # data input
> dataN
> <-read.csv("H:/a_mig_distance_B_NB/R_data/Mig_bird_586_20120925.csv",header=T,
> row.names=1)
> dim(dataN)
> dataN[1,]
> str(dataN)
>
>   # graph
> par(mai=c(1,1.03,0.4,0.4))
>
> obs.group<-dataN$Diet_B
>
> par(new=T)
>
> boxplot(GE_distance~Diet_B, data=dataN,xlab="Diet  of  Breeding
>  Ground",ylab="",
> yaxt="n",type="p",
> pch=1,lwd=0.95,
> cex.lab=1.4, cex.axis=1.2,
> font.axis=2,
> cex=1.5,
> las=1,
> bty="l",
> col=c("forestgreen", "darkgreen","chocolate1","darkorange2","sienna2",
> "red2","firebrick3",
>
> "saddlebrown","coral4","chocolate4","darkblue","navy","grey38")[obs.group]))
>
> op = par(mar = c(5,5,4,2) + 0.1)
> title(ylab = "Distance between Centers of B and NB Range (1000 km)",
> cex.lab = 1.4,line = 3)
>
> axis(side=2,yaxp=c(0,2,4),cex.lab=1.4, cex.axis=1.2,font.axis=2,
> las=1)

-- 
Sarah Goslee
http://www.functionaldiversity.org

__
R-help@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.


Re: [R] Boxplot lattice vs standard graphics

2012-09-17 Thread Massimo Bressan

ok, I see now!
here it is the reproducible example along with the final code (aslo with 
the median line instead of a point)


thank you all for the great help

max

# start code

library(lattice)

test<-structure(list(site = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L,
3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L), .Label = c("A",
"B", "C", "D", "E"), class = "factor"), conc = c(2.32, 0.902,
0.468, 5.51, 1.49, 0.532, 0.72, 0.956, 0.887, 20, 30, 2.12, 0.442,
10, 50, 110, 3.36, 2.41, 20, 70, 3610, 100, 4.79, 20, 0.0315,
30, 60, 1, 3.37, 80, 1.21, 0.302, 0.728, 1.29, 30, 40, 90, 30,
0.697, 6.25, 0.576, 0.335, 20, 10, 620, 40, 9.98, 4.76, 2.61,
3.39, 20, 4.59)), .Names = c("site", "conc"), row.names = c(NA,
52L), class = "data.frame")

mystats <- function(x, ...){ # Here ...
  out <- boxplot.stats(10^x, ...)  # ...and here!!!
  out$stats <- log10(out$stats)
  out$conf <- log10(out$conf) ## Omit if you don't want notches
  out$out <- log10(out$out)
  out ## With the boxplot statistics converted to the log10 scale
}

dev.new()
bwplot(conc~site, data=test,
   pch="|",  # this is plotting a line instead of a point
   scales = list(y=list(log=10)),
   panel = function(...){
 panel.bwplot(..., stats = mystats)
   }
)

# end code

Il 17/09/2012 20:26, Rui Barradas ha scritto:

Hello,

Em 17-09-2012 18:50, David Winsemius escreveu:

On Sep 17, 2012, at 4:18 AM, maxbre wrote:

here it is, I think (I hope)  I'm getting a little closer with this, 
but

still there is something  to sort out...

error using packet 1
unused argument(s)  (coef =1.5, do.out=TRUE)

by reading the help for panel.bwplot at the argument "stats" it 
says: "the
function must accept arguments coef and do.out even if they do not 
use them

(a ... argument is good enough). "
I'm not sure how to couple with this...

any help for this ?

thanks


## start code


mystats <- function(x){
  out <- boxplot.stats(10^x)
  out$stats <- log10(out$stats)
  out$conf <- log10(out$conf) ## Omit if you don't want notches
  out$out <- log10(out$out)
  out$coef<-1.5 #??
  out$do.out<-"TRUE" #??
  out ## With the boxplot statistics converted to the log10 scale
}

bwplot(conc~site, data=test,
   scales=list(y=list(log=10)),
   panel= function(x,y){
 panel.bwplot(x,y,stats=mystats)
   }
   )

No example data, so no efforts at running code.


Actually there is, in the op.



?panel.bwplot

# Notice the Usage at the top of the page. The "..." is there for a 
reason.


# And notice that neither 'do.out' nor 'coef' are passed in the 
"stats" list


# The message was talking about what arguments your 'mystats' would 
accept,  not what it would return. It's another instance of your 
needing to understand what the "..." formalism is doing.


?boxplot.stats

# I would be making a concerted effort to return a list with exactly 
the components listed there.


And since I'm terrible at graphics I try to learn as much as possible 
on R-Help. Here it goes.



library(lattice)

test<-structure(list(site = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L,
3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L), .Label = c("A",
"B", "C", "D", "E"), class = "factor"), conc = c(2.32, 0.902,
0.468, 5.51, 1.49, 0.532, 0.72, 0.956, 0.887, 20, 30, 2.12, 0.442,
10, 50, 110, 3.36, 2.41, 20, 70, 3610, 100, 4.79, 20, 0.0315,
30, 60, 1, 3.37, 80, 1.21, 0.302, 0.728, 1.29, 30, 40, 90, 30,
0.697, 6.25, 0.576, 0.335, 20, 10, 620, 40, 9.98, 4.76, 2.61,
3.39, 20, 4.59)), .Names = c("site", "conc"), row.names = c(NA,
52L), class = "data.frame")


#standard graphics
dev.new()
with(test,boxplot(conc~site, log="y"))

#lattice
mystats <- function(x, ...){ # Here ...
out <- boxplot.stats(10^x, ...)  # ...and here!!!
out$stats <- log10(out$stats)
out$conf <- log10(out$conf) ## Omit if you don't want notches
out$out <- log10(out$out)
out ## With the boxplot statistics converted to the log10 scale
}

dev.new()
bwplot(conc~site, data=test,
   scales = list(y=list(log=10)),
   panel = function(...){
 panel.bwplot(..., stats = mystats)
   }
)

With a median _line_ it would be perfect.
(Not a follow-up, it was already answered some time ago, use pch = "|" 
in panel.bwplot.)


Rui Barradas



## end code







__
R-help@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.


Re: [R] Boxplot lattice vs standard graphics

2012-09-17 Thread Rui Barradas

Hello,

Em 17-09-2012 18:50, David Winsemius escreveu:

On Sep 17, 2012, at 4:18 AM, maxbre wrote:


here it is, I think (I hope)  I'm getting a little closer with this, but
still there is something  to sort out...

error using packet 1
unused argument(s)  (coef =1.5, do.out=TRUE)

by reading the help for panel.bwplot at the argument "stats" it says: "the
function must accept arguments coef and do.out even if they do not use them
(a ... argument is good enough). "
I'm not sure how to couple with this...

any help for this ?

thanks


## start code


mystats <- function(x){
  out <- boxplot.stats(10^x)
  out$stats <- log10(out$stats)
  out$conf <- log10(out$conf) ## Omit if you don't want notches
  out$out <- log10(out$out)
  out$coef<-1.5 #??
  out$do.out<-"TRUE" #??
  out ## With the boxplot statistics converted to the log10 scale
}

bwplot(conc~site, data=test,
   scales=list(y=list(log=10)),
   panel= function(x,y){
 panel.bwplot(x,y,stats=mystats)
   }
   )

No example data, so no efforts at running code.


Actually there is, in the op.



?panel.bwplot

# Notice the Usage at the top of the page. The "..." is there for a reason.

# And notice that neither 'do.out' nor 'coef' are passed in the "stats" list

# The message was talking about what arguments your 'mystats' would accept,  not what 
it would return. It's another instance of your needing to understand what the 
"..." formalism is doing.

?boxplot.stats

# I would be making a concerted effort to return a list with exactly the 
components listed there.


And since I'm terrible at graphics I try to learn as much as possible on 
R-Help. Here it goes.



library(lattice)

test<-structure(list(site = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L,
3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L), .Label = c("A",
"B", "C", "D", "E"), class = "factor"), conc = c(2.32, 0.902,
0.468, 5.51, 1.49, 0.532, 0.72, 0.956, 0.887, 20, 30, 2.12, 0.442,
10, 50, 110, 3.36, 2.41, 20, 70, 3610, 100, 4.79, 20, 0.0315,
30, 60, 1, 3.37, 80, 1.21, 0.302, 0.728, 1.29, 30, 40, 90, 30,
0.697, 6.25, 0.576, 0.335, 20, 10, 620, 40, 9.98, 4.76, 2.61,
3.39, 20, 4.59)), .Names = c("site", "conc"), row.names = c(NA,
52L), class = "data.frame")


#standard graphics
dev.new()
with(test,boxplot(conc~site, log="y"))

#lattice
mystats <- function(x, ...){ # Here ...
out <- boxplot.stats(10^x, ...)  # ...and here!!!
out$stats <- log10(out$stats)
out$conf <- log10(out$conf) ## Omit if you don't want notches
out$out <- log10(out$out)
out ## With the boxplot statistics converted to the log10 scale
}

dev.new()
bwplot(conc~site, data=test,
   scales = list(y=list(log=10)),
   panel = function(...){
 panel.bwplot(..., stats = mystats)
   }
)

With a median _line_ it would be perfect.
(Not a follow-up, it was already answered some time ago, use pch = "|" 
in panel.bwplot.)


Rui Barradas



## end code




__
R-help@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.


Re: [R] Boxplot lattice vs standard graphics

2012-09-17 Thread David Winsemius

On Sep 17, 2012, at 4:18 AM, maxbre wrote:

> here it is, I think (I hope)  I'm getting a little closer with this, but
> still there is something  to sort out...
> 
> error using packet 1
> unused argument(s)  (coef =1.5, do.out=TRUE)
> 
> by reading the help for panel.bwplot at the argument "stats" it says: "the
> function must accept arguments coef and do.out even if they do not use them
> (a ... argument is good enough). "
> I'm not sure how to couple with this...
> 
> any help for this ?
> 
> thanks
> 
> 
> ## start code
> 
> 
> mystats <- function(x){
>  out <- boxplot.stats(10^x)
>  out$stats <- log10(out$stats)
>  out$conf <- log10(out$conf) ## Omit if you don't want notches
>  out$out <- log10(out$out)
>  out$coef<-1.5 #??
>  out$do.out<-"TRUE" #??
>  out ## With the boxplot statistics converted to the log10 scale
> }
> 
> bwplot(conc~site, data=test,
>   scales=list(y=list(log=10)),
>   panel= function(x,y){
> panel.bwplot(x,y,stats=mystats)
>   } 
>   )

No example data, so no efforts at running code.

?panel.bwplot

# Notice the Usage at the top of the page. The "..." is there for a reason.

# And notice that neither 'do.out' nor 'coef' are passed in the "stats" list

# The message was talking about what arguments your 'mystats' would accept, 
 not what it would return. It's another instance of your needing to 
understand what the "..." formalism is doing.

?boxplot.stats

# I would be making a concerted effort to return a list with exactly the 
components listed there.

> ## end code
> 
> 
-- 

David Winsemius, MD
Alameda, CA, USA

__
R-help@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.


Re: [R] Boxplot lattice vs standard graphics

2012-09-17 Thread maxbre
here it is, I think (I hope)  I'm getting a little closer with this, but
still there is something  to sort out...
 
error using packet 1
unused argument(s)  (coef =1.5, do.out=TRUE)

by reading the help for panel.bwplot at the argument "stats" it says: "the
function must accept arguments coef and do.out even if they do not use them
(a ... argument is good enough). "
I'm not sure how to couple with this...

any help for this ?

thanks


## start code


mystats <- function(x){
  out <- boxplot.stats(10^x)
  out$stats <- log10(out$stats)
  out$conf <- log10(out$conf) ## Omit if you don't want notches
  out$out <- log10(out$out)
  out$coef<-1.5 #??
  out$do.out<-"TRUE" #??
  out ## With the boxplot statistics converted to the log10 scale
}

bwplot(conc~site, data=test,
   scales=list(y=list(log=10)),
   panel= function(x,y){
 panel.bwplot(x,y,stats=mystats)
   } 
   )


## end code



--
View this message in context: 
http://r.789695.n4.nabble.com/Boxplot-lattice-vs-standard-graphics-tp4643121p4643357.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] Boxplot lattice vs standard graphics

2012-09-17 Thread Massimo Bressan

thank you for the help, bert

unfortunately, for reasons I can not understand (yet) I can not put to 
wortk it all

(I'm always in trouble with the panel functions);

max

Il 14/09/2012 18:38, Bert Gunter ha scritto:

Thanks for the example. Makes it easy to see what you mean.

Yes, if I understand you correctly, you are right:
boxplot() (base) transforms the axes, so ?boxplot.stats, which is the
function that essentially computes the boxplot, does so on the
original data.
bwplot(lattice) transforms the data first, as the documentation for
the "log" component of the scales list makes clear, and **then** calls
boxplot.stats.

Although I think the latter makes more sense then the former, I think
the way to do it is to modify the "stats" function in an explicit call
to panel.bwplot to something like (UNTESTED!)
mystats <- function(x){
out <- boxplot.stats(10^x)
out$stats <- log10(out$stats)
out$conf <- log10(out$conf) ## Omit if you don't want notches
out$out <- log10(out$out)
out ## With the boxplot statistics converted to the log10 scale
}

I leave it to you to test and modify as necessary.

Cheers,
Bert

On Fri, Sep 14, 2012 at 2:37 AM, maxbre  wrote:

Given my reproducible example

test<-structure(list(site = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L,
3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L), .Label = c("A",
"B", "C", "D", "E"), class = "factor"), conc = c(2.32, 0.902,
0.468, 5.51, 1.49, 0.532, 0.72, 0.956, 0.887, 20, 30, 2.12, 0.442,
10, 50, 110, 3.36, 2.41, 20, 70, 3610, 100, 4.79, 20, 0.0315,
30, 60, 1, 3.37, 80, 1.21, 0.302, 0.728, 1.29, 30, 40, 90, 30,
0.697, 6.25, 0.576, 0.335, 20, 10, 620, 40, 9.98, 4.76, 2.61,
3.39, 20, 4.59)), .Names = c("site", "conc"), row.names = c(NA,
52L), class = "data.frame")



And the following code

#standard graphics
with(test,boxplot(conc~site, log="y"))

#lattice
bwplot(conc~site, data=test,
scales=list(y=list(log=10))
)

There is an evident difference for site A, B, D in the way some outliers are
plotted by comparing the plot produced by lattice vs. the standard graphics

I think to understand this might be due to the different treatment of data:
i.e. log transformation (before or after the plotting?)

Is it possible to achieve the same plotting result with both graphic
facilities?
I would like to show the outliers also in lattice…

Thank you

http://r.789695.n4.nabble.com/file/n4643121/standard.png

http://r.789695.n4.nabble.com/file/n4643121/lattice.png





--
View this message in context: 
http://r.789695.n4.nabble.com/Boxplot-lattice-vs-standard-graphics-tp4643121.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.





__
R-help@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.


Re: [R] Boxplot lattice vs standard graphics

2012-09-14 Thread Bert Gunter
Thanks for the example. Makes it easy to see what you mean.

Yes, if I understand you correctly, you are right:
boxplot() (base) transforms the axes, so ?boxplot.stats, which is the
function that essentially computes the boxplot, does so on the
original data.
bwplot(lattice) transforms the data first, as the documentation for
the "log" component of the scales list makes clear, and **then** calls
boxplot.stats.

Although I think the latter makes more sense then the former, I think
the way to do it is to modify the "stats" function in an explicit call
to panel.bwplot to something like (UNTESTED!)
mystats <- function(x){
out <- boxplot.stats(10^x)
out$stats <- log10(out$stats)
out$conf <- log10(out$conf) ## Omit if you don't want notches
out$out <- log10(out$out)
out ## With the boxplot statistics converted to the log10 scale
}

I leave it to you to test and modify as necessary.

Cheers,
Bert

On Fri, Sep 14, 2012 at 2:37 AM, maxbre  wrote:
> Given my reproducible example
>
> test<-structure(list(site = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 2L,
> 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L,
> 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
> 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L), .Label = c("A",
> "B", "C", "D", "E"), class = "factor"), conc = c(2.32, 0.902,
> 0.468, 5.51, 1.49, 0.532, 0.72, 0.956, 0.887, 20, 30, 2.12, 0.442,
> 10, 50, 110, 3.36, 2.41, 20, 70, 3610, 100, 4.79, 20, 0.0315,
> 30, 60, 1, 3.37, 80, 1.21, 0.302, 0.728, 1.29, 30, 40, 90, 30,
> 0.697, 6.25, 0.576, 0.335, 20, 10, 620, 40, 9.98, 4.76, 2.61,
> 3.39, 20, 4.59)), .Names = c("site", "conc"), row.names = c(NA,
> 52L), class = "data.frame")
>
>
>
> And the following code
>
> #standard graphics
> with(test,boxplot(conc~site, log="y"))
>
> #lattice
> bwplot(conc~site, data=test,
>scales=list(y=list(log=10))
>)
>
> There is an evident difference for site A, B, D in the way some outliers are
> plotted by comparing the plot produced by lattice vs. the standard graphics
>
> I think to understand this might be due to the different treatment of data:
> i.e. log transformation (before or after the plotting?)
>
> Is it possible to achieve the same plotting result with both graphic
> facilities?
> I would like to show the outliers also in lattice…
>
> Thank you
>
> http://r.789695.n4.nabble.com/file/n4643121/standard.png
>
> http://r.789695.n4.nabble.com/file/n4643121/lattice.png
>
>
>
>
>
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Boxplot-lattice-vs-standard-graphics-tp4643121.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> R-help@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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

__
R-help@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.


Re: [R] boxplot - bclust

2012-09-04 Thread David Meyer


These are warnings and I think that you can safely ignore them.
It looks like the code should replace the line

  if (x$datamean)

with something like

  if (!is.null(x$datamean))


Yes, I think so too - thanks for reporting this.

David

__
R-help@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.


Re: [R] boxplot - bclust

2012-09-03 Thread Peter Ehlers

On 2012-09-03 08:34, Dominic Roye wrote:

Hello everybody,

I have a problem with the commando of boxplot -bclust.
http://127.0.0.1:13155/library/e1071/html/boxplot.bclust.html



data(iris)
bc1 <- bclust(iris[,1:4], 3, base.centers=5)

Committee Member: 1(1) 2(1) 3(1) 4(1) 5(1) 6(1) 7(1) 8(1) 9(1) 10(1)
Computing Hierarchical Clustering

boxplot(bc1)

Warnmeldungen:
1: In if (x$datamean) { :
   Bedingung hat Länge > 1 und nur das erste Element wird benutzt (Condition
has length > 1 and only the first element is used) # It's normal? Why?
2: In if (x$datamean) { :
   Bedingung hat Länge > 1 und nur das erste Element wird benutzt
3: In if (x$datamean) { :
   Bedingung hat Länge > 1 und nur das erste Element wird benutzt




These are warnings and I think that you can safely ignore them.
It looks like the code should replace the line

 if (x$datamean)

with something like

 if (!is.null(x$datamean))

Peter Ehlers



Thank you for your help.

Best regards,

Dominic

[[alternative HTML version deleted]]



__
R-help@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.


Re: [R] boxplot help

2012-08-15 Thread John Kane
Okay your first main problem is that you have Year and Month as character 
variables.

I think you need to convert them to a single date: Try this:
eagle$dates  <-  as.Date(paste(dd, "/", "01", sep=""), "%Y/%b/%d")

I think this helps cure a lot of the problem.

However a different approach to the same results I think is this using the 
ggplot2 package which I imagine you would have to install ( 
install.packages("ggplot2") 

I noticed that your dput() example only had data for a part of one year so I 
manufactored some data to use as an example.  However you still need to create 
the dates column.  




# Data Set

mydat <- structure(list(roof = structure(c(1L, 3L, 2L, 1L, 1L, 2L, 3L, 
3L, 3L, 1L, 1L, 1L, 3L, 1L, 1L, 2L, 3L, 1L, 1L, 1L, 1L, 1L, 3L, 
1L, 3L, 1L, 3L, 3L, 3L, 3L, 2L, 2L, 3L, 1L, 2L, 3L, 2L, 1L, 2L, 
3L, 3L, 1L, 1L, 3L, 3L, 1L, 3L, 2L, 3L, 2L), .Label = c("bare", 
"tt13", "tt6"), class = "factor"), dates = structure(c(8L, 8L, 
3L, 3L, 8L, 9L, 5L, 7L, 11L, 1L, 11L, 12L, 7L, 12L, 3L, 4L, 2L, 
2L, 9L, 6L, 6L, 6L, 11L, 12L, 4L, 1L, 3L, 12L, 5L, 2L, 9L, 10L, 
11L, 6L, 1L, 11L, 5L, 9L, 4L, 9L, 9L, 2L, 12L, 1L, 11L, 9L, 2L, 
9L, 4L, 6L), .Label = c("2011-06-01", "2011-07-01", "2011-08-01", 
"2011-09-01", "2011-10-01", "2011-11-01", "2011-12-01", "2012-01-01", 
"2012-02-01", "2012-03-01", "2012-04-01", "2012-05-01"), class = "factor"), 
temp = c(17.33, 16.92, 17.06, 17.79, 17.63, 5.16, 13.85, 
14.3, 14.44, 11.32, 15.15, 15.04, 17.72, 10.33, 10.46, 9.25, 
10.7, 13.72, 19.2, 9.03, 8.69, 13.41, 16.08, 19.91, 10.87, 
14.06, 16.57, 8.66, 17.74, 15.71, 17.91, 7.26, 15.89, 22.14, 
15.93, 20.01, 18.45, 12.34, 15.67, 13.7, 10.68, 7.2, 16.83, 
13.99, 14.69, 16.13, 20.35, 16.89, 19.34, 15.05), year = c(2012L, 
2012L, 2011L, 2011L, 2012L, 2012L, 2011L, 2011L, 2012L, 2011L, 
2012L, 2012L, 2011L, 2012L, 2011L, 2011L, 2011L, 2011L, 2012L, 
2011L, 2011L, 2011L, 2012L, 2012L, 2011L, 2011L, 2011L, 2012L, 
2011L, 2011L, 2012L, 2012L, 2012L, 2011L, 2011L, 2012L, 2011L, 
2012L, 2011L, 2012L, 2012L, 2011L, 2012L, 2011L, 2012L, 2012L, 
2011L, 2012L, 2011L, 2011L)), .Names = c("roof", "dates", 
"temp", "year"), class = "data.frame", row.names = c(NA, -50L
))


# Then give this a try. It looks a bit weird as I just generated a bunch of 
dates.
#=
library(ggplot2)
p  <-  ggplot( mydat , aes(as.factor(dates) , temp, fill = factor(roof))) + 
geom_boxplot(statistic = "identity") + 
   ylab("Temperature") + xlab("Months")  + 
scale_fill_hue(name="Roof\nType")  +
facet_grid( year ~ .)
p

# ===

John Kane
Kingston ON Canada


> -Original Message-
> From: freakyspe...@hotmail.com
> Sent: Wed, 15 Aug 2012 09:52:36 -0700 (PDT)
> To: r-help@r-project.org
> Subject: Re: [R] boxplot help
> 
> hi thanks
> 
> the dput output is...
> 
> structure(list(Year = c(2011L, 2011L, 2011L, 2011L, 2011L, 2011L,
> 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L,
> 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L,
> 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L,
> 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L,
> 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L), Month =
> structure(c(1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> 1L), .Label = c("Apr", "Aug", "Dec", "Feb", "Jan", "Jul", "Jun",
> "Mar", "May", "Nov", "Oct", "Sep"), class = "factor"), Roof =
> structure(c(3L,
> 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
> 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
> 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
> 3L), .Label = c("BARE", "TT13", "TT6"), class = "factor"), Temp =
> c(10.68,
> 11.8, 12.16, 12.36, 12.5, 12.58, 12.46, 12.72, 12.31, 12.35,
> 12.44, 12.59, 12.86, 13.05, 13.83, 13.92, 14.24, 14.47, 13.84,
> 13.44, 12.83, 12.73, 12.47, 12.18, 12.59, 12.36, 12.09, 11.73,
> 13.02, 13.16, 13.21, 13.53, 14.15, 14.67, 15.53, 15.48, 17.43,
> 18.56, 22.6, 25.06, 20.36, 18.78, 15.29, 11.98, 10.23, 9.42,
> 8.38, 7.37, 6.47, 6.3)), .Names = c("Year", "Month", "Roof",
> "Temp"), row.n

Re: [R] boxplot help

2012-08-15 Thread Rui Barradas

Hello,

I'm not sure wether this is what you want, but here it goes.

dd <- structure( ...etc... )  # your dataset

# make group identifiers
ym <- paste(dd$Year, as.character(dd$Month), sep="-")

op <- par(las=2) # make labels perpendicular to axis
bp <- boxplot(Temp ~ ym, data=dd)
axis(1, at = seq_along(unique(ym)), labels = bp$names)
par(op)

If it's what you want, add color and legend.

Hope this helps,

Rui Barradas

Em 15-08-2012 17:52, andyspeak escreveu:

hi thanks

the dput output is...

structure(list(Year = c(2011L, 2011L, 2011L, 2011L, 2011L, 2011L,
2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L,
2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L,
2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L,
2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L,
2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L), Month =
structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L), .Label = c("Apr", "Aug", "Dec", "Feb", "Jan", "Jul", "Jun",
"Mar", "May", "Nov", "Oct", "Sep"), class = "factor"), Roof =
structure(c(3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L), .Label = c("BARE", "TT13", "TT6"), class = "factor"), Temp = c(10.68,
11.8, 12.16, 12.36, 12.5, 12.58, 12.46, 12.72, 12.31, 12.35,
12.44, 12.59, 12.86, 13.05, 13.83, 13.92, 14.24, 14.47, 13.84,
13.44, 12.83, 12.73, 12.47, 12.18, 12.59, 12.36, 12.09, 11.73,
13.02, 13.16, 13.21, 13.53, 14.15, 14.67, 15.53, 15.48, 17.43,
18.56, 22.6, 25.06, 20.36, 18.78, 15.29, 11.98, 10.23, 9.42,
8.38, 7.37, 6.47, 6.3)), .Names = c("Year", "Month", "Roof",
"Temp"), row.names = c(NA, 50L), class = "data.frame")

But as this is only first 50 rows then it doesnt show that some of the data
is Jan - Jul of 2012 which i want displaying separately from Apr-Jul 2011
data.

I think the next reply i recieved points me to a good solution.



--
View this message in context: 
http://r.789695.n4.nabble.com/boxplot-help-tp4640360p4640392.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


__
R-help@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.


Re: [R] boxplot help

2012-08-15 Thread andyspeak
hi thanks

the dput output is...

structure(list(Year = c(2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 
2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 
2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 
2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 
2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 
2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L), Month =
structure(c(1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L), .Label = c("Apr", "Aug", "Dec", "Feb", "Jan", "Jul", "Jun", 
"Mar", "May", "Nov", "Oct", "Sep"), class = "factor"), Roof =
structure(c(3L, 
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
3L), .Label = c("BARE", "TT13", "TT6"), class = "factor"), Temp = c(10.68, 
11.8, 12.16, 12.36, 12.5, 12.58, 12.46, 12.72, 12.31, 12.35, 
12.44, 12.59, 12.86, 13.05, 13.83, 13.92, 14.24, 14.47, 13.84, 
13.44, 12.83, 12.73, 12.47, 12.18, 12.59, 12.36, 12.09, 11.73, 
13.02, 13.16, 13.21, 13.53, 14.15, 14.67, 15.53, 15.48, 17.43, 
18.56, 22.6, 25.06, 20.36, 18.78, 15.29, 11.98, 10.23, 9.42, 
8.38, 7.37, 6.47, 6.3)), .Names = c("Year", "Month", "Roof", 
"Temp"), row.names = c(NA, 50L), class = "data.frame")

But as this is only first 50 rows then it doesnt show that some of the data
is Jan - Jul of 2012 which i want displaying separately from Apr-Jul 2011
data.

I think the next reply i recieved points me to a good solution.



--
View this message in context: 
http://r.789695.n4.nabble.com/boxplot-help-tp4640360p4640392.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] boxplot help

2012-08-15 Thread Richard M. Heiberger
Hi,

I recommend the use of panel.bwplot.intermediate.hh in the HH package.
This is a lattice function.  Lattice usually gives you more control than
base graphics.

I build your example in several steps here.
Critical items to notice:
You must declare the months to be ordered; by default they are sorted
alphabetically.
The position() function in the HH package gives control of the spacing of
factor levels in an axis.
The default axis labels are overprinting.  By displaying only the 2, 5, ...
label, and by
grouping the three group levels within each month, you get a more readable
graph.
In your jpg example, there are an excess of outliers.  Please be sure to
understand what they represent.

Rich



## install.packages("HH") ## if needed
library(HH)

mycolors <- c("lightgreen", "darkgreen", "red")

tmp <- data.frame(y=rnorm(612),
  month=rep(ordered(month.abb, levels=month.abb), 51),
  group=rep(ordered(mycolors, levels=mycolors), 3, each=17))
gm <- with(tmp, interaction(group, month))

bwplot(y ~ month | group, data=tmp, main="first attempt", layout=c(3,1))
bwplot(y ~ gm, data=tmp, col=mycolors, main="second attempt")
bwplot(y ~ gm, data=tmp, col=mycolors, main="third attempt",
   panel=panel.bwplot.intermediate.hh)

bwplot(y ~ gm, data=tmp, col=mycolors, main="fourth attempt",
   panel=panel.bwplot.intermediate.hh,
   key=list(
 text=list(mycolors, col=mycolors),
 space="right", border=TRUE, title="Group Name",cex.title=.9),
   scales=list(x=list(at=(3*(1:12)-1), labels=month.abb)))

position(gm) <- as.vector(outer(c(-.8,0,.8), (3*(1:12)-1), "+"))
bwplot(y ~ gm, data=tmp, col=mycolors, panel=panel.bwplot.intermediate.hh,
   key=list(
 text=list(mycolors, col=mycolors),
 space="right", border=TRUE, title="Group Name",cex.title=.9),
   scales=list(x=list(at=(3*(1:12)-1), labels=month.abb)),
   main="fifth: what you asked for")


On Wed, Aug 15, 2012 at 8:34 AM, andyspeak  wrote:

> Hi, im a newbie with very wobbly coding abilities.
> Tearing my hair out over getting the boxplot i want...
>
> I have a dataset called 'eagle' which consists of year (2011 or 2012),
> month
> (jan - dec), roof (TT6, TT13 or BARE) and temp (the continuous variable
> that
> i want to plot).
> So i want boxplots of the three roof treatments in every month organised in
> chronical order along x axis 2011 - 2012.
>
> my code at the moment is:
>
> > boxplot(Temp~Month, data=eagle, at = 1:12 - 0.5, boxwex=0.25, subset=Roof
> > == "TT6", col = "green")
> > boxplot(Temp~Month, data=eagle, add=TRUE, at = 1:12 - 0.1, boxwex = 0.25,
> > subset=Roof == "TT13", col = "darkgreen")
> > boxplot(Temp~Month, data=eagle, add=TRUE, boxwex=0.25, at = 1:12 + 0.2,
> > subset=Roof == "BARE", col = "red")
> > smartlegend(x="left",y="top", inset = 0, c("green 1", "green 2", "bare"),
> > fill = c("green", "darkgreen", "red"))
>
> which produces the graph inserted
>
> Can anyone point me in right direction?
> thanks  http://r.789695.n4.nabble.com/file/n4640360/boxplot_trial.jpg
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/boxplot-help-tp4640360.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> R-help@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.
>

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] boxplot help

2012-08-15 Thread John Kane
Hi Andy,

Nice plot but yes, probably not exactly what you want.  

Thanks for providing the code.  The nextthing you need to do is to send us some 
data to go with the code.  There is a very handy function called dput() , which 
converts a dataset into a format that you can just copy from your R terminal 
and paste into an email that allows readers to work wiith your data or a sample 
of it.

If the dataset is really large then something like dput(head (mydata, 50))  
will supply the first fifty rows of data for us to work with.

One of your problems seems to be that your dates are character values and need 
to be converted into datesfor you to get the chronological date order.  See 
?strptime  or perhaps install the lubridate package for help there.

Otherwise welcome to R 

Note to other readers : I think I actually got the dput syntax this time!!

John Kane
Kingston ON Canada


> -Original Message-
> From: freakyspe...@hotmail.com
> Sent: Wed, 15 Aug 2012 05:34:55 -0700 (PDT)
> To: r-help@r-project.org
> Subject: [R] boxplot help
> 
> Hi, im a newbie with very wobbly coding abilities.
> Tearing my hair out over getting the boxplot i want...
> 
> I have a dataset called 'eagle' which consists of year (2011 or 2012),
> month
> (jan - dec), roof (TT6, TT13 or BARE) and temp (the continuous variable
> that
> i want to plot).
> So i want boxplots of the three roof treatments in every month organised
> in
> chronical order along x axis 2011 - 2012.
> 
> my code at the moment is:
> 
>> boxplot(Temp~Month, data=eagle, at = 1:12 - 0.5, boxwex=0.25,
>> subset=Roof
>> == "TT6", col = "green")
>> boxplot(Temp~Month, data=eagle, add=TRUE, at = 1:12 - 0.1, boxwex =
>> 0.25,
>> subset=Roof == "TT13", col = "darkgreen")
>> boxplot(Temp~Month, data=eagle, add=TRUE, boxwex=0.25, at = 1:12 + 0.2,
>> subset=Roof == "BARE", col = "red")
>> smartlegend(x="left",y="top", inset = 0, c("green 1", "green 2",
>> "bare"),
>> fill = c("green", "darkgreen", "red"))
> 
> which produces the graph inserted
> 
> Can anyone point me in right direction?
> thanks  http://r.789695.n4.nabble.com/file/n4640360/boxplot_trial.jpg
> 
> 
> 
> --
> View this message in context:
> http://r.789695.n4.nabble.com/boxplot-help-tp4640360.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> R-help@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.


GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at 
http://www.inbox.com/smileys
Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and most 
webmails

__
R-help@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.


Re: [R] Boxplot graphic

2012-07-25 Thread John Fox
Dear phillen,

You can use the identify() command following boxplot() to identify outliers, or 
more simply, the Boxplot() function in the car package, which will do this for 
you (see the first example in ?Boxplot).

I hope this helps,
 John


John Fox
Sen. William McMaster Prof. of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/

On Wed, 25 Jul 2012 04:26:30 -0700 (PDT)
 phillen  wrote:
> Dear R-users!
> 
> I boxplotted some data. the class of the data is numeric. There are some
> outliers and I would like to see their names in the graphic. So, instead
> that the data points of the outliers are plotted as points, I would like to
> have their names plotted.
> 
> First of, how can I give my data series (class numeric) names? Second, how
> could I adjust the boxplot to see the names of the outliers in the graphic
> instead of the points?
> 
> cheers
> 
> 
> 
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Boxplot-graphic-tp4637761.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> R-help@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.

__
R-help@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.


Re: [R] Boxplot graphic

2012-07-25 Thread S Ellison
Probably the simplest answer is to google 'label boxplot outliers in R'. I 
found half a dozen solutions, (one of them my own, but that doesn't quite 
answer your question).

Adding names to a series of data can be as simple as saying
names(x) <- paste("x", 1:length(x))

After that, the solutions google finds answer the question.

One tip: If you want to _replace_ points with names, plot the boxplot with 
pch=NA (eg
bx <- boxplot(x~g, pch=NA)
to get the boxplot without outliers but with space for them, and then use 
text(bx$group, bx$out, ...) or similar to put the names in. If you want boxplot 
to return names, though, you will need to use a modified boxplot function. The 
first answer Google returns is one such.

S Ellison

> -Original Message-
> From: r-help-boun...@r-project.org 
> [mailto:r-help-boun...@r-project.org] On Behalf Of phillen
> Sent: 25 July 2012 12:27
> To: r-help@r-project.org
> Subject: [R] Boxplot graphic
> 
> Dear R-users!
> 
> I boxplotted some data. the class of the data is numeric. 
> There are some outliers and I would like to see their names 
> in the graphic. So, instead that the data points of the 
> outliers are plotted as points, I would like to have their 
> names plotted.
> 
> First of, how can I give my data series (class numeric) 
> names? Second, how could I adjust the boxplot to see the 
> names of the outliers in the graphic instead of the points?
> 
> cheers
> 
> 
> 
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Boxplot-graphic-tp4637761.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> R-help@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.
> 

***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
R-help@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.


Re: [R] Boxplot graphic

2012-07-25 Thread Uwe Ligges



On 25.07.2012 13:26, phillen wrote:

Dear R-users!

I boxplotted some data. the class of the data is numeric. There are some
outliers and I would like to see their names in the graphic. So, instead
that the data points of the outliers are plotted as points, I would like to
have their names plotted.

First of, how can I give my data series (class numeric) names?



See ?names


Second, how
could I adjust the boxplot to see the names of the outliers in the graphic
instead of the points?


See ?boxplot

Example:

x <- c(1:10, 100)
names(x) <- letters[1:11]
bp <- boxplot(x)
text(1, bp$out, names(x)[bp$out==x], pos=2)






cheers



--
View this message in context: 
http://r.789695.n4.nabble.com/Boxplot-graphic-tp4637761.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.



__
R-help@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.


Re: [R] Boxplot graphic

2012-07-25 Thread John Kane
PLEASE do read the posting guide.

You really need to supply some sample data and the code you are using.  We can 
make guesses about what you are doing but it is much easier to actually look at 
the data and code.

Please use dput()  ( see ?dput) to supply some sample data.

John Kane
Kingston ON Canada


> -Original Message-
> From: phlent...@gmail.com
> Sent: Wed, 25 Jul 2012 04:26:30 -0700 (PDT)
> To: r-help@r-project.org
> Subject: [R] Boxplot graphic
> 
> Dear R-users!
> 
> I boxplotted some data. the class of the data is numeric. There are some
> outliers and I would like to see their names in the graphic. So, instead
> that the data points of the outliers are plotted as points, I would like
> to
> have their names plotted.
> 
> First of, how can I give my data series (class numeric) names? Second,
> how
> could I adjust the boxplot to see the names of the outliers in the
> graphic
> instead of the points?
> 
> cheers
> 
> 
> 
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Boxplot-graphic-tp4637761.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> R-help@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.


GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at 
http://www.inbox.com/smileys
Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and most 
webmails

__
R-help@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.


Re: [R] Boxplot names

2012-07-19 Thread S Ellison
> When i make Boxplots with a lot of boxes, the names of them 
> get only written down every second "column".
> Since they aren't in any way ordered, you don't see anymore 
> to what they belong.

Jessica,

Another possibility if the names are long is to use abbreviated factor levels. 
The labels appear when there is room; they are only omitted if there isn't 
space. So you could use  something like

y <- rnorm(55)
g <- factor(paste("Unduly long factor level name", rep(1:5, each=11)))

boxplot(y~g) #Not useful

ga <- g
levels(ga) <- abbreviate(levels(g))
boxplot(y~ga) #Much better

If you don't want to change the actual factor level labels, use something like

boxplot(y~g, axes=FALSE, at=1:nlevels(g))
box()
axis(2)
axis(1, at=1:nlevels(g), labels=abbreviate(levels(g)))
# or 
axis(1, at=1:nlevels(g), labels=abbreviate(levels(g)), las=2) #vertical text


S Ellison

***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
R-help@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.


Re: [R] Boxplot names

2012-07-19 Thread John Fox
Dear Jessica,

You might try par(las=2) to rotate the tick labels to be perpendicular to the 
axes.

I hope this helps,
 John


John Fox
Sen. William McMaster Prof. of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/

On Thu, 19 Jul 2012 16:58:26 +0200
 Jessica Streicher  wrote:
> Copied the wrong lines, sry
> 
> l<-rep(list(1:5),20); boxplot(l,names=sample(1:20,20))
> 
> of course.
> 
> thanks for the answer
> 
> .
> On 19.07.2012, at 16:17, Peter Ehlers wrote:
> 
> > On 2012-07-19 06:58, Jessica Streicher wrote:
> >> When i make Boxplots with a lot of boxes, the names of them get only 
> >> written down every second "column".
> >> Since they aren't in any way ordered, you don't see anymore to what they 
> >> belong.
> >> 
> >> example:
> >> 
> >> l<-rep(list(1:5),20); boxplot(l,names=sample(20,1:20))
> >> 
> >> Is there a way to show them all, or do i have to split the plots?
> > 
> > [Actually, your example is not reproducible without error - see
> > ?sample.]
> > 
> > Two solutions:
> > 1. use the cex.axis argument to reduce the label size.
> > 2. check out the staxlab() function in the plotrix package.
> > 
> > Peter Ehlers
> > 
> > 
> 
> __
> R-help@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.

__
R-help@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.


Re: [R] Boxplot names

2012-07-19 Thread Bert Gunter
You might alternatively find the horizontal = TRUE with las=2 to be useful; e.g.

dat <- data.frame(val=rnorm(100),
  
grp=rep(apply(matrix(sample(letters,100,rep=TRUE),nr=5),2,paste,collapse=""),5))

boxplot(val~grp,horizontal=TRUE,data=dat,las=2)

## Note that las=2 might also help with horizontal=FALSE, but I prefer
reading Roman language labels horizontally. CJK languages might prefer
vertically.

-- Bert




On Thu, Jul 19, 2012 at 7:58 AM, Jessica Streicher
 wrote:
>
> Copied the wrong lines, sry
>
> l<-rep(list(1:5),20); boxplot(l,names=sample(1:20,20))
>
> of course.
>
> thanks for the answer
>
> .
> On 19.07.2012, at 16:17, Peter Ehlers wrote:
>
> > On 2012-07-19 06:58, Jessica Streicher wrote:
> >> When i make Boxplots with a lot of boxes, the names of them get only 
> >> written down every second "column".
> >> Since they aren't in any way ordered, you don't see anymore to what they 
> >> belong.
> >>
> >> example:
> >>
> >> l<-rep(list(1:5),20); boxplot(l,names=sample(20,1:20))
> >>
> >> Is there a way to show them all, or do i have to split the plots?
> >
> > [Actually, your example is not reproducible without error - see
> > ?sample.]
> >
> > Two solutions:
> > 1. use the cex.axis argument to reduce the label size.
> > 2. check out the staxlab() function in the plotrix package.
> >
> > Peter Ehlers
> >
> >
>
> __
> R-help@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.




--

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

__
R-help@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.


Re: [R] Boxplot names

2012-07-19 Thread Jessica Streicher
Copied the wrong lines, sry

l<-rep(list(1:5),20); boxplot(l,names=sample(1:20,20))

of course.

thanks for the answer

.
On 19.07.2012, at 16:17, Peter Ehlers wrote:

> On 2012-07-19 06:58, Jessica Streicher wrote:
>> When i make Boxplots with a lot of boxes, the names of them get only written 
>> down every second "column".
>> Since they aren't in any way ordered, you don't see anymore to what they 
>> belong.
>> 
>> example:
>> 
>> l<-rep(list(1:5),20); boxplot(l,names=sample(20,1:20))
>> 
>> Is there a way to show them all, or do i have to split the plots?
> 
> [Actually, your example is not reproducible without error - see
> ?sample.]
> 
> Two solutions:
> 1. use the cex.axis argument to reduce the label size.
> 2. check out the staxlab() function in the plotrix package.
> 
> Peter Ehlers
> 
> 

__
R-help@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.


Re: [R] Boxplot names

2012-07-19 Thread Peter Ehlers

On 2012-07-19 06:58, Jessica Streicher wrote:

When i make Boxplots with a lot of boxes, the names of them get only written down every 
second "column".
Since they aren't in any way ordered, you don't see anymore to what they belong.

example:

l<-rep(list(1:5),20); boxplot(l,names=sample(20,1:20))

Is there a way to show them all, or do i have to split the plots?


[Actually, your example is not reproducible without error - see
?sample.]

Two solutions:
1. use the cex.axis argument to reduce the label size.
2. check out the staxlab() function in the plotrix package.

Peter Ehlers

__
R-help@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.


Re: [R] boxplot with "cut"

2012-07-10 Thread Rui Barradas

Hello,

Maybe this iss what you're looking for. GD is your data.frame.



multi.boxplot <- function(x, by, ...){
x <- as.data.frame(x)
sp <- split(x, by)
len <- length(sp) - 1
n <- ncol(x)
n1 <- n + 1
boxplot(x[[ 1 ]] ~ by, at = 0:len*n1 + 1,
xlim = c(0, (len + 1)*n1), ylim = range(unlist(x)), xaxt = "n", 
...)
for(i in seq_len(n)[-1])
boxplot(x[[i]] ~ by, at = 0:len*n1 + i, xaxt = "n", add = TRUE, 
...)
axis(1, at = 0:len*n1 + n1/2, labels = names(sp), tick = TRUE)
}

cols <- grep("ReadCount", names(GD))
multi.boxplot(GD[, cols], cut(GD$GeneDensity, breaks=10))


If this is it and you don't like those x-axis tick lables, use 
as.integer(cut(...etc...)).


Hope this helps,

Rui Barradas

Em 09-07-2012 20:51, Vining, Kelly escreveu:

Dear UseRs,
I'm making box plots from a data set that looks like this:


   Chr Start   End GeneDensity ReadCount_Explant ReadCount_Callus 
ReadCount_Regen
1   1 1 1  107.82 1.2431.047   1.496
2   1 10001 2  202.50 0.8350.869   0.456
3   1 20001 3  158.80 1.8131.529   1.131
4   1 30001 4  100.53 1.7311.752   1.610
5   1 40001 5  100.53 3.0562.931   3.631
6   1 50001 6  100.53 1.9602.013   2.459

I'm breaking the "GeneDensity" column into deciles, then making a box plot of the 
relationship between the GeneDensity parameter and each of the three "ReadCount" columns. 
Here's an example of one of my boxplot commands:

boxplot(GeneDensity$ReadCount_Explant ~ cut(GeneDensitySorted$GeneDensity, breaks=10), ylim=c(0,40), 
ylab="RPKM", xlab="GENE DENSITY (LOW -> HIGH)", main="INTERNODE EXPLANT")

Right now, I'm making three separate graphs: one for each of the three 
"ReadCount" columns. I'd like to put all three sets on one graph, so that each 
decile is represented by three boxes, one for each ReadCount category, but don't know how 
to make that work. I tried this:

boxplot(GeneDensitySorted$ReadCount_Explant ~ cut(GeneDensitySorted$GeneDensity, breaks=10), 
GeneDensitySorted$ReadCount_Callus ~ cut(GeneDensitySorted$GeneDensity, breaks=10), 
GeneDensitySorted$ReadCount_Regen ~ cut(GeneDensitySorted$GeneDensity, breaks=10), ylim=c(0,40), 
ylab="RPKM", xlab="GENE DENSITY (LOW -> HIGH)")

Not surprisingly, I got this error:

Error in as.data.frame.default(data) :
   cannot coerce class '"formula"' into a data.frame

Does anyone know how to accomplish this box plot?

Any help is much appreciated.

--Kelly V.
__
R-help@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.



__
R-help@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.


Re: [R] Boxplot with Log10 and base-exponent axis

2012-06-25 Thread Luigi
Dear Mr Dunlap,
Your solution works really fine. Thank you for your time,
Best wishes,
Luigi


-Original Message-
From: William Dunlap [mailto:wdun...@tibco.com] 
Sent: 23 June 2012 18:48
To: Luigi
Cc: 'Martin Maechler'; r-help@r-project.org
Subject: RE: [R] Boxplot with Log10 and base-exponent axis

To change the y-limits you need to add ylim=c(min,max)
to the call to boxplot.  The limits there should be
in the units of the y variable (not its log10).  par("usr")[3:4]
report the y-limits on the log10 scale (they will be expanded
a bit from your desired limits so the plot does not extend
all the way to edge).

> boxplot(abs(tan(1:100)), log="y", ylim=c(.001, 1000))
> par("usr")[3:4]
[1] -3.24  3.24
> 10 ^ par("usr")[3:4]
[1] 5.754399e-04 1.737801e+03

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 

> -Original Message-
> From: Luigi [mailto:marongiu.lu...@gmail.com]
> Sent: Saturday, June 23, 2012 8:49 AM
> To: William Dunlap
> Cc: 'Martin Maechler'; r-help@r-project.org
> Subject: RE: [R] Boxplot with Log10 and base-exponent axis
> 
> Thank you!
> This works good. I understand that the value are now in Log10 scale,
> although I did not understand what is happening  at line 4 of your script.
> I would like to ask how can I change the y limits since they now depend on
> par("user"). What if I'd like y limits extending from 1000 to 1 000 000?
> I've tried to modify ylim (line 3) and ceiling (line 4) but I obtained
> errors.
> Best wishes,
> Luigi
> 
> 
> ### UPDATED EXAMPLE

> # generationg random numbers
>   x<-runif(100, min=0, max=10)
> 
> 
> #plotting
>   boxplot(x, log = "y", yaxt="n")
>ylim <- par("usr")[3:4]
> 
>   log10AtY <- seq(ceiling(ylim[1]), floor(ylim[2]))
> 
>   axis(side=2, at=10^log10AtY, lab=as.expression(lapply(log10AtY,
> function(y)bquote(10^.(y)
> 
>

> #
> 
> 
> -- Your Response
> 
> The key is to supply an expression, not text, to the labels argument to
> axis.
> See help("plotmath") for details.  Here is an example:
> 1  x <- list(One=10^(sin(1:10)+5), Two=10^(cos(1:30)*2))
> 2  boxplot(x, log="y", yaxt="n")
> 3  ylim <- par("usr")[3:4]
> 4  log10AtY <- seq(ceiling(ylim[1]), floor(ylim[2]))
> 5  axis(side=2, at=10^log10AtY, lab=as.expression(lapply(log10AtY,
> function(y)bquote(10^.(y)
> 
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
> 
> > -Original Message-
> > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf
> > Of Luigi
> > Sent: Friday, June 22, 2012 7:54 AM
> > To: r-help@r-project.org
> > Subject: [R] Boxplot with Log10 and base-exponent axis
> >
> > Dear all,
> >
> > I would like to (i) produce boxplot graphs with axis in logarithm in
base
> 10
> > and (ii) showing the values on the axis in 10^exponent format rather
than
> > 10E+exponent.
> >
> >
> >
> > To illustrate with an example, I have some widely spread data that I
chart
> > plot using  boxplot() [figure on the left]; the log="y" option of
> boxplot()
> > I obtained the natural logarithm conversion of the data and the
unfriendly
> > notation baseE+exponent [figure on the centre]; if I log10 the data I
> obtain
> > the desired plot, but the axis are showing only the exponent. [figure on
> the
> > right].
> >
> >
> >
> > Can anybody help?
> >
> >
> >
> > Best regards
> >
> > Luigi Marongiu, MSc
> >
> >
> >
> > ### EXAMPLE 
> >
> > # generationg random numbers
> >
> > x<-runif(100, min=0, max=10)
> >
> >
> >
> > # create plot
> >
> > par(mfrow = c(1,3))
> >
> >
> >
> > #plotting in the left side
> >
> > boxplot(x, xlab="Linear values")
> >
> >
> >
> > #plotting in the centre
> >
> > boxplot(x, log = "y", xlab="y axis logged")
> >
> >
> >
> > # creating log10 values and plotting on the right side
> >
> > Log.base10.x<-log10(x)
> >
> > boxplot(Log.base10.x, xlab="LOG10 of data")
> >
> >
> >
> >
> >
> >
> > [[alternative HTML version deleted]]
> >
> > __
> > R-help@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.

__
R-help@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.


Re: [R] Boxplot with Log10 and base-exponent axis

2012-06-24 Thread Steve Taylor
This (and William's solution) is so good, I must ask:  
Is there a good reason why this is not the default functionality in the 
graphics package?  

The default displays the number 1 as 1+e00 which is hideous!

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Martin Maechler
Sent: Saturday, 23 June 2012 4:57a
To: Luigi; William Dunlap
Cc: r-help@r-project.org
Subject: Re: [R] Boxplot with Log10 and base-exponent axis


> The key is to supply an expression, not text, to the labels argument to axis.
> See help("plotmath") for details.  Here is an example:


>   x <- list(One=10^(sin(1:10)+5), Two=10^(cos(1:30)*2))
>   boxplot(x, log="y", yaxt="n")
>   ylim <- par("usr")[3:4]
>   log10AtY <- seq(ceiling(ylim[1]), floor(ylim[2]))
>   axis(side=2, at=10^log10AtY, lab=as.expression(lapply(log10AtY, 
> function(y)bquote(10^.(y)

Yes, that's nice, and exactly the basic idea.

For a few years now,  the  eaxis() function in package "sfsmisc" 
does (something like) this (and a bit more) even more nicely :

 install.packages("sfsmisc")
 require("sfsmisc")

 x <- list(One=10^(sin(1:10)+5), Two=10^(cos(1:30)*2))
 boxplot(x, log="y", yaxt="n")
 eaxis(2)

--
Martin Maechler, ETH Zurich

__
R-help@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.


Re: [R] Boxplot with Log10 and base-exponent axis

2012-06-23 Thread William Dunlap
To change the y-limits you need to add ylim=c(min,max)
to the call to boxplot.  The limits there should be
in the units of the y variable (not its log10).  par("usr")[3:4]
report the y-limits on the log10 scale (they will be expanded
a bit from your desired limits so the plot does not extend
all the way to edge).

> boxplot(abs(tan(1:100)), log="y", ylim=c(.001, 1000))
> par("usr")[3:4]
[1] -3.24  3.24
> 10 ^ par("usr")[3:4]
[1] 5.754399e-04 1.737801e+03

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 

> -Original Message-
> From: Luigi [mailto:marongiu.lu...@gmail.com]
> Sent: Saturday, June 23, 2012 8:49 AM
> To: William Dunlap
> Cc: 'Martin Maechler'; r-help@r-project.org
> Subject: RE: [R] Boxplot with Log10 and base-exponent axis
> 
> Thank you!
> This works good. I understand that the value are now in Log10 scale,
> although I did not understand what is happening  at line 4 of your script.
> I would like to ask how can I change the y limits since they now depend on
> par("user"). What if I'd like y limits extending from 1000 to 1 000 000?
> I've tried to modify ylim (line 3) and ceiling (line 4) but I obtained
> errors.
> Best wishes,
> Luigi
> 
> 
> ### UPDATED EXAMPLE 
> # generationg random numbers
>   x<-runif(100, min=0, max=10)
> 
> 
> #plotting
>   boxplot(x, log = "y", yaxt="n")
>ylim <- par("usr")[3:4]
> 
>   log10AtY <- seq(ceiling(ylim[1]), floor(ylim[2]))
> 
>   axis(side=2, at=10^log10AtY, lab=as.expression(lapply(log10AtY,
> function(y)bquote(10^.(y)
> 
> 
> #
> 
> 
> -- Your Response
> 
> The key is to supply an expression, not text, to the labels argument to
> axis.
> See help("plotmath") for details.  Here is an example:
> 1  x <- list(One=10^(sin(1:10)+5), Two=10^(cos(1:30)*2))
> 2  boxplot(x, log="y", yaxt="n")
> 3  ylim <- par("usr")[3:4]
> 4  log10AtY <- seq(ceiling(ylim[1]), floor(ylim[2]))
> 5  axis(side=2, at=10^log10AtY, lab=as.expression(lapply(log10AtY,
> function(y)bquote(10^.(y)
> 
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
> 
> > -Original Message-
> > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf
> > Of Luigi
> > Sent: Friday, June 22, 2012 7:54 AM
> > To: r-help@r-project.org
> > Subject: [R] Boxplot with Log10 and base-exponent axis
> >
> > Dear all,
> >
> > I would like to (i) produce boxplot graphs with axis in logarithm in base
> 10
> > and (ii) showing the values on the axis in 10^exponent format rather than
> > 10E+exponent.
> >
> >
> >
> > To illustrate with an example, I have some widely spread data that I chart
> > plot using  boxplot() [figure on the left]; the log="y" option of
> boxplot()
> > I obtained the natural logarithm conversion of the data and the unfriendly
> > notation baseE+exponent [figure on the centre]; if I log10 the data I
> obtain
> > the desired plot, but the axis are showing only the exponent. [figure on
> the
> > right].
> >
> >
> >
> > Can anybody help?
> >
> >
> >
> > Best regards
> >
> > Luigi Marongiu, MSc
> >
> >
> >
> > ### EXAMPLE 
> >
> > # generationg random numbers
> >
> > x<-runif(100, min=0, max=10)
> >
> >
> >
> > # create plot
> >
> > par(mfrow = c(1,3))
> >
> >
> >
> > #plotting in the left side
> >
> > boxplot(x, xlab="Linear values")
> >
> >
> >
> > #plotting in the centre
> >
> > boxplot(x, log = "y", xlab="y axis logged")
> >
> >
> >
> > # creating log10 values and plotting on the right side
> >
> > Log.base10.x<-log10(x)
> >
> > boxplot(Log.base10.x, xlab="LOG10 of data")
> >
> >
> >
> >
> >
> >
> > [[alternative HTML version deleted]]
> >
> > __
> > R-help@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.

__
R-help@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.


Re: [R] Boxplot with Log10 and base-exponent axis

2012-06-23 Thread Luigi
Thank you!
This works good. I understand that the value are now in Log10 scale,
although I did not understand what is happening  at line 4 of your script. 
I would like to ask how can I change the y limits since they now depend on
par("user"). What if I'd like y limits extending from 1000 to 1 000 000?
I've tried to modify ylim (line 3) and ceiling (line 4) but I obtained
errors.
Best wishes,
Luigi


### UPDATED EXAMPLE 
# generationg random numbers
x<-runif(100, min=0, max=10)


#plotting 
boxplot(x, log = "y", yaxt="n")
 ylim <- par("usr")[3:4]
  
log10AtY <- seq(ceiling(ylim[1]), floor(ylim[2]))

axis(side=2, at=10^log10AtY, lab=as.expression(lapply(log10AtY,
function(y)bquote(10^.(y)


#


-- Your Response

The key is to supply an expression, not text, to the labels argument to
axis.
See help("plotmath") for details.  Here is an example:
1  x <- list(One=10^(sin(1:10)+5), Two=10^(cos(1:30)*2))
2  boxplot(x, log="y", yaxt="n")
3  ylim <- par("usr")[3:4]
4  log10AtY <- seq(ceiling(ylim[1]), floor(ylim[2]))
5  axis(side=2, at=10^log10AtY, lab=as.expression(lapply(log10AtY,
function(y)bquote(10^.(y)

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com

> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf
> Of Luigi
> Sent: Friday, June 22, 2012 7:54 AM
> To: r-help@r-project.org
> Subject: [R] Boxplot with Log10 and base-exponent axis
> 
> Dear all,
> 
> I would like to (i) produce boxplot graphs with axis in logarithm in base
10
> and (ii) showing the values on the axis in 10^exponent format rather than
> 10E+exponent.
> 
> 
> 
> To illustrate with an example, I have some widely spread data that I chart
> plot using  boxplot() [figure on the left]; the log="y" option of
boxplot()
> I obtained the natural logarithm conversion of the data and the unfriendly
> notation baseE+exponent [figure on the centre]; if I log10 the data I
obtain
> the desired plot, but the axis are showing only the exponent. [figure on
the
> right].
> 
> 
> 
> Can anybody help?
> 
> 
> 
> Best regards
> 
> Luigi Marongiu, MSc
> 
> 
> 
> ### EXAMPLE 
> 
> # generationg random numbers
> 
> x<-runif(100, min=0, max=10)
> 
> 
> 
> # create plot
> 
> par(mfrow = c(1,3))
> 
> 
> 
> #plotting in the left side
> 
> boxplot(x, xlab="Linear values")
> 
> 
> 
> #plotting in the centre
> 
> boxplot(x, log = "y", xlab="y axis logged")
> 
> 
> 
> # creating log10 values and plotting on the right side
> 
> Log.base10.x<-log10(x)
> 
> boxplot(Log.base10.x, xlab="LOG10 of data")
> 
> 
> 
> 
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@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.

__
R-help@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.


Re: [R] Boxplot with Log10 and base-exponent axis

2012-06-22 Thread Martin Maechler

> The key is to supply an expression, not text, to the labels argument to axis.
> See help("plotmath") for details.  Here is an example:


>   x <- list(One=10^(sin(1:10)+5), Two=10^(cos(1:30)*2))
>   boxplot(x, log="y", yaxt="n")
>   ylim <- par("usr")[3:4]
>   log10AtY <- seq(ceiling(ylim[1]), floor(ylim[2]))
>   axis(side=2, at=10^log10AtY, lab=as.expression(lapply(log10AtY, 
> function(y)bquote(10^.(y)

Yes, that's nice, and exactly the basic idea.

For a few years now,  the  eaxis() function in package "sfsmisc" 
does (something like) this (and a bit more) even more nicely :

 install.packages("sfsmisc")
 require("sfsmisc")

 x <- list(One=10^(sin(1:10)+5), Two=10^(cos(1:30)*2))
 boxplot(x, log="y", yaxt="n")
 eaxis(2)

--
Martin Maechler, ETH Zurich

> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com

> > -Original Message-
> > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
> > Behalf
> > Of Luigi
> > Sent: Friday, June 22, 2012 7:54 AM
> > To: r-help@r-project.org
> > Subject: [R] Boxplot with Log10 and base-exponent axis
> > 
> > Dear all,
> > 
> > I would like to (i) produce boxplot graphs with axis in logarithm in base 10
> > and (ii) showing the values on the axis in 10^exponent format rather than
> > 10E+exponent.
> > 
> > 
> > 
> > To illustrate with an example, I have some widely spread data that I chart
> > plot using  boxplot() [figure on the left]; the log="y" option of boxplot()
> > I obtained the natural logarithm conversion of the data and the unfriendly
> > notation baseE+exponent [figure on the centre]; if I log10 the data I obtain
> > the desired plot, but the axis are showing only the exponent. [figure on the
> > right].
> > 
> > 
> > 
> > Can anybody help?
> > 
> > 
> > 
> > Best regards
> > 
> > Luigi Marongiu, MSc
> > 
> > 
> > 
> > ### EXAMPLE 
> > 
> > # generationg random numbers
> > 
> > x<-runif(100, min=0, max=10)
> > 
> > 
> > 
> > # create plot
> > 
> > par(mfrow = c(1,3))
> > 
> > 
> > 
> > #plotting in the left side
> > 
> > boxplot(x, xlab="Linear values")
> > 
> > 
> > 
> > #plotting in the centre
> > 
> > boxplot(x, log = "y", xlab="y axis logged")
> > 
> > 
> > 
> > # creating log10 values and plotting on the right side
> > 
> > Log.base10.x<-log10(x)
> > 
> > boxplot(Log.base10.x, xlab="LOG10 of data")
> > 
> > 
> > 
> > 
> > 
> > 
> > [[alternative HTML version deleted]]
> > 
> > __
> > R-help@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.

__
R-help@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.


Re: [R] Boxplot with Log10 and base-exponent axis

2012-06-22 Thread William Dunlap
You might prefer placing the tick marks with
  log10AtY <- log10(axTicks(side=2))
  log10AtY <- unique(round(log10AtY))
instead of the
  ylim <- par("usr")[3:4]
  log10AtY <- seq(ceiling(ylim[1]), floor(ylim[2]))
in my original example.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
> Behalf
> Of William Dunlap
> Sent: Friday, June 22, 2012 8:14 AM
> To: Luigi; r-help@r-project.org
> Subject: Re: [R] Boxplot with Log10 and base-exponent axis
> 
> The key is to supply an expression, not text, to the labels argument to axis.
> See help("plotmath") for details.  Here is an example:
>   x <- list(One=10^(sin(1:10)+5), Two=10^(cos(1:30)*2))
>   boxplot(x, log="y", yaxt="n")
>   ylim <- par("usr")[3:4]
>   log10AtY <- seq(ceiling(ylim[1]), floor(ylim[2]))
>   axis(side=2, at=10^log10AtY, lab=as.expression(lapply(log10AtY,
> function(y)bquote(10^.(y)
> 
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
> 
> > -Original Message-
> > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
> > Behalf
> > Of Luigi
> > Sent: Friday, June 22, 2012 7:54 AM
> > To: r-help@r-project.org
> > Subject: [R] Boxplot with Log10 and base-exponent axis
> >
> > Dear all,
> >
> > I would like to (i) produce boxplot graphs with axis in logarithm in base 10
> > and (ii) showing the values on the axis in 10^exponent format rather than
> > 10E+exponent.
> >
> >
> >
> > To illustrate with an example, I have some widely spread data that I chart
> > plot using  boxplot() [figure on the left]; the log="y" option of boxplot()
> > I obtained the natural logarithm conversion of the data and the unfriendly
> > notation baseE+exponent [figure on the centre]; if I log10 the data I obtain
> > the desired plot, but the axis are showing only the exponent. [figure on the
> > right].
> >
> >
> >
> > Can anybody help?
> >
> >
> >
> > Best regards
> >
> > Luigi Marongiu, MSc
> >
> >
> >
> > ### EXAMPLE 
> >
> > # generationg random numbers
> >
> > x<-runif(100, min=0, max=10)
> >
> >
> >
> > # create plot
> >
> > par(mfrow = c(1,3))
> >
> >
> >
> > #plotting in the left side
> >
> > boxplot(x, xlab="Linear values")
> >
> >
> >
> > #plotting in the centre
> >
> > boxplot(x, log = "y", xlab="y axis logged")
> >
> >
> >
> > # creating log10 values and plotting on the right side
> >
> > Log.base10.x<-log10(x)
> >
> > boxplot(Log.base10.x, xlab="LOG10 of data")
> >
> >
> >
> >
> >
> >
> > [[alternative HTML version deleted]]
> >
> > __
> > R-help@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.
> 
> __
> R-help@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.

__
R-help@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.


Re: [R] Boxplot with Log10 and base-exponent axis

2012-06-22 Thread William Dunlap
The key is to supply an expression, not text, to the labels argument to axis.
See help("plotmath") for details.  Here is an example:
  x <- list(One=10^(sin(1:10)+5), Two=10^(cos(1:30)*2))
  boxplot(x, log="y", yaxt="n")
  ylim <- par("usr")[3:4]
  log10AtY <- seq(ceiling(ylim[1]), floor(ylim[2]))
  axis(side=2, at=10^log10AtY, lab=as.expression(lapply(log10AtY, 
function(y)bquote(10^.(y)

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com

> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
> Behalf
> Of Luigi
> Sent: Friday, June 22, 2012 7:54 AM
> To: r-help@r-project.org
> Subject: [R] Boxplot with Log10 and base-exponent axis
> 
> Dear all,
> 
> I would like to (i) produce boxplot graphs with axis in logarithm in base 10
> and (ii) showing the values on the axis in 10^exponent format rather than
> 10E+exponent.
> 
> 
> 
> To illustrate with an example, I have some widely spread data that I chart
> plot using  boxplot() [figure on the left]; the log="y" option of boxplot()
> I obtained the natural logarithm conversion of the data and the unfriendly
> notation baseE+exponent [figure on the centre]; if I log10 the data I obtain
> the desired plot, but the axis are showing only the exponent. [figure on the
> right].
> 
> 
> 
> Can anybody help?
> 
> 
> 
> Best regards
> 
> Luigi Marongiu, MSc
> 
> 
> 
> ### EXAMPLE 
> 
> # generationg random numbers
> 
> x<-runif(100, min=0, max=10)
> 
> 
> 
> # create plot
> 
> par(mfrow = c(1,3))
> 
> 
> 
> #plotting in the left side
> 
> boxplot(x, xlab="Linear values")
> 
> 
> 
> #plotting in the centre
> 
> boxplot(x, log = "y", xlab="y axis logged")
> 
> 
> 
> # creating log10 values and plotting on the right side
> 
> Log.base10.x<-log10(x)
> 
> boxplot(Log.base10.x, xlab="LOG10 of data")
> 
> 
> 
> 
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@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.

__
R-help@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.


Re: [R] Boxplot superscript y-axis

2012-05-29 Thread Carlos Rivera
Dear Prof. Eduardo,

Try this:

rot<-expression(paste("DGL growth (cm.yr"^"-1",")"))
boxplot(five$gr13~five$Code, xlab="Species code", ylab=rot)

In this page there are some useful mathematical annotations in R:
http://stat.ethz.ch/R-manual/R-patched/library/grDevices/html/plotmath.html

Best wishes,

Carlos Rivera


-Mensaje original-
De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] En
nombre de eduardo van den Berg
Enviado el: martes, 29 de mayo de 2012 17:24
Para: r-help@r-project.org
Asunto: [R] Boxplot superscript y-axis

Dear list,

I need to include in a superscript number (-1) in a y-axis label of a
boxplot graphic. I tried the following line:

>boxplot(five$gr13~five$Code, xlab="Species code",
ylab=substitute(paste("DGL growth (cm.yr"^{-1},")")))

It returns the following error message:

Error in "DGL growth (cm.yr"^{ : non-numeric argument to binary operator

I used the same line for the plot function in another graphic and it worked
perfectly well.

Any suggestions?


--
Prof. Eduardo van den Berg
Dpto. de Biologia - Universidade Federal de Lavras Cx. P. 3037 37200-000,
Lavras, MG, Brasil Tel 35-3829-1917 E-mail eduardo.lav...@gmail.com

[[alternative HTML version deleted]]

__
R-help@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.

__
R-help@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.


  1   2   3   >