Quantcast

Help

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Help

li li-13
Dear all,
  I need some help on plotting multiple boxplots on one figure.
  I have three matrix A, B and C. Each of them is a 1000 by 10 matrix.
The 10 columns of all three matrix correspond to the
10 values of the same parameter, say k=1, ..., 10.
  I want to make a plot where x axis represents different values of k.
For each k value, I want to plot three boxplots, one on top of another.
For example, for k=1, I want to draw three boxplot based on the first
column of A, B and C respectively. Similarly, I do the same for the rest of
k values.
  Can some one give me some hint on this?
  Thank you so much.
        Hannah

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Help

PIKAL Petr
Hi

It seems to me that it can be done by ggplot2 package. However I do not
understand what is three boxplots one on top of another? How could you see
the bottom boxplot when it is twice overplotted?

library(ggplot2)
p <- ggplot(mtcars, aes(factor(cyl), mpg))
p + geom_boxplot(aes(fill = factor(vs)))

Regards
Petr


>
> Dear all,
>   I need some help on plotting multiple boxplots on one figure.
>   I have three matrix A, B and C. Each of them is a 1000 by 10 matrix.
> The 10 columns of all three matrix correspond to the
> 10 values of the same parameter, say k=1, ..., 10.
>   I want to make a plot where x axis represents different values of k.
> For each k value, I want to plot three boxplots, one on top of another.
> For example, for k=1, I want to draw three boxplot based on the first
> column of A, B and C respectively. Similarly, I do the same for the rest
of

> k values.
>   Can some one give me some hint on this?
>   Thank you so much.
>         Hannah
>
>    [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Help

David Carlson
Here are two possibilities depending on what you mean by "on top" of one
another:

> A <- matrix(rnorm(1000), ncol=10)
> B <- matrix(rnorm(1000), ncol=10)
> C <- matrix(rnorm(1000), ncol=10)
> oldpar <- par(mfrow=c(3,1), mar=c(3, 3, 2, 2))
> boxplot(A)
> boxplot(B)
> boxplot(C)
> par(oldpar)

Or really "on top" using color and changing the size of the boxes to make
them visible.

> boxplot(A)
> boxplot(B, border="red", boxwex=.7, add=TRUE)
> boxplot(C, border="blue", boxwex=.6, add=TRUE)

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


> -----Original Message-----
> From: [hidden email] [mailto:r-help-bounces@r-
> project.org] On Behalf Of Petr PIKAL
> Sent: Friday, June 29, 2012 3:30 AM
> To: li li
> Cc: r-help
> Subject: Re: [R] Help
>
> Hi
>
> It seems to me that it can be done by ggplot2 package. However I do not
> understand what is three boxplots one on top of another? How could you
> see
> the bottom boxplot when it is twice overplotted?
>
> library(ggplot2)
> p <- ggplot(mtcars, aes(factor(cyl), mpg))
> p + geom_boxplot(aes(fill = factor(vs)))
>
> Regards
> Petr
>
>
> >
> > Dear all,
> >   I need some help on plotting multiple boxplots on one figure.
> >   I have three matrix A, B and C. Each of them is a 1000 by 10
> matrix.
> > The 10 columns of all three matrix correspond to the
> > 10 values of the same parameter, say k=1, ..., 10.
> >   I want to make a plot where x axis represents different values of
> k.
> > For each k value, I want to plot three boxplots, one on top of
> another.
> > For example, for k=1, I want to draw three boxplot based on the first
> > column of A, B and C respectively. Similarly, I do the same for the
> rest
> of
> > k values.
> >   Can some one give me some hint on this?
> >   Thank you so much.
> >         Hannah
> >
> >    [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] 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.
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Help

John Kane
In reply to this post by li li-13
I think I may understand what you want.

I 'd say the first thing to do is to combine the 3 matrices into a single data frame with a column for the values of A, B C

Here is a mock-up with something like what I mean. I just used two columns of data for the mock-up.

Then, you can reshape the data using melt() from the reshape2 package and then graph the data using ggplot from the ggplot2 package.

Is this something like what you want?
=============================================================

library(ggplot2)
library(reshape2)

A  <-  data.frame( m = (rep("A", 10)) , b=rnorm(10), c = rnorm(10))
B  <-  data.frame( m = (rep("B", 10)) , b=rnorm(10), c = rnorm(10))
C  <-  data.frame( m = (rep("C", 10)) , b=rnorm(10), c = rnorm(10))

mydata  <-  rbind( A, B, C )
names(mydata)  <-  c( "group", "k1", "k2" )
mdata  <-  melt(mydata)

p  <-  ggplot( mdata , aes(variable, value , colour = variable )) + geom_boxplot() +
           facet_grid( group ~ .)
p

==============================================================

John Kane
Kingston ON Canada


> -----Original Message-----
> From: [hidden email]
> Sent: Thu, 28 Jun 2012 16:29:54 -0400
> To: [hidden email]
> Subject: [R] Help
>
> Dear all,
>   I need some help on plotting multiple boxplots on one figure.
>   I have three matrix A, B and C. Each of them is a 1000 by 10 matrix.
> The 10 columns of all three matrix correspond to the
> 10 values of the same parameter, say k=1, ..., 10.
>   I want to make a plot where x axis represents different values of k.
> For each k value, I want to plot three boxplots, one on top of another.
> For example, for k=1, I want to draw three boxplot based on the first
> column of A, B and C respectively. Similarly, I do the same for the rest
> of
> k values.
>   Can some one give me some hint on this?
>   Thank you so much.
>         Hannah
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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!

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Help

li li-13
Hi Petr, David and John,
  Thanks for the reply. I am sorry that I did not make it very clear.
"One on top of another" may not be the right expression.
Actually what I wanted is the second option of David's. There
are 10 columns in the plot and, in each column, there are three boxplots.
Different colors can be used to distinguish the three boxplots in the
same column.
    John, when I run the code, I got the message below:

Error in rq.fit.br(x, y, tau = tau, ...) : Singular design matrix
In addition: Warning message:
In is.na(rows) : is.na() applied to non-(list or vector) of type 'NULL'


Thanks again, everyone.
      Hannah

2012/6/29 John Kane <[hidden email]>

> I think I may understand what you want.
>
> I 'd say the first thing to do is to combine the 3 matrices into a single
> data frame with a column for the values of A, B C
>
> Here is a mock-up with something like what I mean. I just used two columns
> of data for the mock-up.
>
> Then, you can reshape the data using melt() from the reshape2 package and
> then graph the data using ggplot from the ggplot2 package.
>
> Is this something like what you want?
> =============================================================
>
> library(ggplot2)
> library(reshape2)
>
> A  <-  data.frame( m = (rep("A", 10)) , b=rnorm(10), c = rnorm(10))
> B  <-  data.frame( m = (rep("B", 10)) , b=rnorm(10), c = rnorm(10))
> C  <-  data.frame( m = (rep("C", 10)) , b=rnorm(10), c = rnorm(10))
>
> mydata  <-  rbind( A, B, C )
> names(mydata)  <-  c( "group", "k1", "k2" )
> mdata  <-  melt(mydata)
>
> p  <-  ggplot( mdata , aes(variable, value , colour = variable )) +
> geom_boxplot() +
>           facet_grid( group ~ .)
> p
>
> ==============================================================
>
> John Kane
> Kingston ON Canada
>
>
> > -----Original Message-----
> > From: [hidden email]
> > Sent: Thu, 28 Jun 2012 16:29:54 -0400
> > To: [hidden email]
> > Subject: [R] Help
> >
> > Dear all,
> >   I need some help on plotting multiple boxplots on one figure.
> >   I have three matrix A, B and C. Each of them is a 1000 by 10 matrix.
> > The 10 columns of all three matrix correspond to the
> > 10 values of the same parameter, say k=1, ..., 10.
> >   I want to make a plot where x axis represents different values of k.
> > For each k value, I want to plot three boxplots, one on top of another.
> > For example, for k=1, I want to draw three boxplot based on the first
> > column of A, B and C respectively. Similarly, I do the same for the rest
> > of
> > k values.
> >   Can some one give me some hint on this?
> >   Thank you so much.
> >         Hannah
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] 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!
>
>
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Help

John Kane

   Hi Hannah,
   I have run both the original code and the code copied from the email and
   both seem to work just fine.
   I don't know why you are getting that error message.   Do you have both
   ggplot2 and reshape2 loaded?  Still that should not give you the error
   message you are getting. In fact given the data I supplied, I just don't
   understand what it is trying to say.
   I cannot even find a function [1]rq.fit.br.  Perhaps some other library that
   you have loaded is masking something in ggplot2 or reshape2.  Can any more
   savvy R users comment here?
   Here is a link to the output  which I think sounds like what you want.

   [2]http://www.mediafire.com/i/?sgc2evfen5vvckb
   It  only  has two columns of data since I'm too lazy to do more but in
   principle it does any number as along at the output device can show it.
   Here  is  my sessionInfo() in case we have some serious differences in
   settings.
   sessionInfo()
   R version 2.15.1 (2012-06-22)
   Platform: i686-pc-linux-gnu (32-bit)
   locale:
    [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
    [3] LC_TIME=en_CA.UTF-8        LC_COLLATE=en_US.UTF-8
    [5] LC_MONETARY=en_CA.UTF-8    LC_MESSAGES=en_US.UTF-8
    [7] LC_PAPER=C                 LC_NAME=C
    [9] LC_ADDRESS=C               LC_TELEPHONE=C
   [11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C
   attached base packages:
   [1] stats     graphics  grDevices utils     datasets  methods   base
   other attached packages:
   [1] reshape2_1.2.1 ggplot2_0.9.1
   loaded via a namespace (and not attached):
    [1]      colorspace_1.1-1        dichromat_1.2-4         digest_0.5.2
   grid_2.15.1
    [5]       labeling_0.1            MASS_7.3-18             memoise_0.1
   munsell_0.3
    [9]    plyr_1.7.1            proto_0.3-9.2         RColorBrewer_1.0-5
   scales_0.2.1
   [13] stringr_0.6



   John Kane
   Kingston ON Canada

   -----Original Message-----
   From: [hidden email]
   Sent: Fri, 29 Jun 2012 21:31:55 -0400
   To: [hidden email]
   Subject: Re: [R] Help

   Hi Petr, David and John,
     Thanks for the reply. I am sorry that I did not make it very clear.
   "One on top of another" may not be the right expression.
   Actually what I wanted is the second option of David's. There
   are 10 columns in the plot and, in each column, there are three boxplots.
   Different colors can be used to distinguish the three boxplots in the
   same column.
       John, when I run the code, I got the message below:
   Error in [3]rq.fit.br(x, y, tau = tau, ...) : Singular design matrix
   In addition: Warning message:
   In [4]is.na(rows) : [5]is.na() applied to non-(list or vector) of type
   'NULL'
   Thanks again, everyone.
         Hannah
   2012/6/29 John Kane <[6][hidden email]>

     I think I may understand what you want.
     I 'd say the first thing to do is to combine the 3 matrices into a single
     data frame with a column for the values of A, B C
     Here is a mock-up with something like what I mean. I just used two columns
     of data for the mock-up.
     Then, you can reshape the data using melt() from the reshape2 package and
     then graph the data using ggplot from the ggplot2 package.
     Is this something like what you want?
     =============================================================
     library(ggplot2)
     library(reshape2)
     A  <-  data.frame( m = (rep("A", 10)) , b=rnorm(10), c = rnorm(10))
     B  <-  data.frame( m = (rep("B", 10)) , b=rnorm(10), c = rnorm(10))
     C  <-  data.frame( m = (rep("C", 10)) , b=rnorm(10), c = rnorm(10))
     mydata  <-  rbind( A, B, C )
     names(mydata)  <-  c( "group", "k1", "k2" )
     mdata  <-  melt(mydata)
     p  <-  ggplot( mdata , aes(variable, value , colour = variable )) +
     geom_boxplot() +
               facet_grid( group ~ .)
     p
     ==============================================================
     John Kane
     Kingston ON Canada

   > -----Original Message-----
   > From: [7][hidden email]
   > Sent: Thu, 28 Jun 2012 16:29:54 -0400
   > To: [8][hidden email]
   > Subject: [R] Help
   >
   > Dear all,
   >   I need some help on plotting multiple boxplots on one figure.
   >   I have three matrix A, B and C. Each of them is a 1000 by 10 matrix.
   > The 10 columns of all three matrix correspond to the
   > 10 values of the same parameter, say k=1, ..., 10.
   >   I want to make a plot where x axis represents different values of k.
   > For each k value, I want to plot three boxplots, one on top of another.
   > For example, for k=1, I want to draw three boxplot based on the first
   > column of A, B and C respectively. Similarly, I do the same for the rest
   > of
   > k values.
   >   Can some one give me some hint on this?
   >   Thank you so much.
   >         Hannah
   >

   >       [[alternative HTML version deleted]]
   >
   > ______________________________________________
   > [9][hidden email] mailing list
   > [10]https://stat.ethz.ch/mailman/listinfo/r-help
   > PLEASE do read the posting guide
   > [11]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 [12]http://www.inbox.com/photosharing to find out more!
     _________________________________________________________________

   Get Free 5GB Email – Check out spam free email with many cool features!
   Visit [13]http://www.inbox.com/email to find out more!

References

   1. http://rq.fit.br/
   2. http://www.mediafire.com/i/?sgc2evfen5vvckb
   3. http://rq.fit.br/
   4. http://is.na/
   5. http://is.na/
   6. mailto:[hidden email]
   7. mailto:[hidden email]
   8. mailto:[hidden email]
   9. mailto:[hidden email]
  10. https://stat.ethz.ch/mailman/listinfo/r-help
  11. http://www.R-project.org/posting-guide.html
  12. http://www.inbox.com/photosharing
  13. http://www.inbox.com/email
______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Help

Peter Ehlers
On 2012-06-30 07:04, John Kane wrote:
>
>     Hi Hannah,
>     I have run both the original code and the code copied from the email and
>     both seem to work just fine.
>     I don't know why you are getting that error message.   Do you have both
>     ggplot2 and reshape2 loaded?  Still that should not give you the error
>     message you are getting. In fact given the data I supplied, I just don't
>     understand what it is trying to say.
>     I cannot even find a function [1]rq.fit.br.
[...]

This function is in the quantreg *package*. So Hannah isn't
telling us the whole story.

Peter Ehlers

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Help

li li-13
The following is what I get when I run the code.


> library(ggplot2)
Loading required package: reshape
Loading required package: plyr

Attaching package: 'reshape'

The following object(s) are masked from 'package:plyr':

    rename, round_any

Loading required package: grid
Loading required package: proto
> library(reshape2)

Attaching package: 'reshape2'

The following object(s) are masked from 'package:reshape':

    colsplit, melt, recast

>
> A  <-  data.frame( m = (rep("A", 10)) , b=rnorm(10), c = rnorm(10))
> B  <-  data.frame( m = (rep("B", 10)) , b=rnorm(10), c = rnorm(10))
> C  <-  data.frame( m = (rep("C", 10)) , b=rnorm(10), c = rnorm(10))
>
> mydata  <-  rbind( A, B, C )
> names(mydata)  <-  c( "group", "k1", "k2" )
> mdata  <-  melt(mydata)
Using group as id variables
>
> p  <-  ggplot( mdata , aes(variable, value , colour = variable )) +
geom_boxplot() +
+           facet_grid( group ~ .)
> p
Error in rq.fit.br(x, y, tau = tau, ...) : Singular design matrix
In addition: Warning message:
In is.na(rows) : is.na() applied to non-(list or vector) of type 'NULL'
>


And my session info is as below:


> sessionInfo()
R version 2.12.2 (2011-02-25)
Platform: i386-apple-darwin9.8.0/i386 (32-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods
[8] base

other attached packages:
[1] quantreg_4.71 SparseM_0.89  reshape2_1.1  ggplot2_0.8.9 proto_0.3-9.2
[6] reshape_0.8.4 plyr_1.6

loaded via a namespace (and not attached):
[1] stringr_0.5


When I tried to load package ggplot, I was asked to also load some of the
other packages, for example "plyr". Thanks.
    Hannah

2012/6/30 Peter Ehlers <[hidden email]>

> On 2012-06-30 07:04, John Kane wrote:
>
>>
>>    Hi Hannah,
>>    I have run both the original code and the code copied from the email
>> and
>>    both seem to work just fine.
>>    I don't know why you are getting that error message.   Do you have both
>>    ggplot2 and reshape2 loaded?  Still that should not give you the error
>>    message you are getting. In fact given the data I supplied, I just
>> don't
>>    understand what it is trying to say.
>>    I cannot even find a function [1]rq.fit.br.
>>
> [...]
>
> This function is in the quantreg *package*. So Hannah isn't
> telling us the whole story.
>
> Peter Ehlers
>
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Help

John Kane
It looks like we have different versions of software loaded.
I have R version 2.15.0 (2012-03-30)

My packages.
reshape2_1.2.1 ggplot2_0.9.0

Hannah's packages.
R version 2.12.2 (2011-02-25)
 quantreg_4.71 SparseM_0.89  reshape2_1.1  ggplot2_0.8.9 proto_0.3-9.2
[6] reshape_0.8.4 plyr_1.6


It looks like quantreg is causing a problem since Peter says that the function is in the quantreg *package*.

The first step would probably be to make sure that quantreg is not loaded and try the code again.  It "probably" would work with an older version of ggplot2 and the old version of reshape.  The command : unattach(package::quantreg) should work.  

Retry the code and see what happens.

However I I think that you need to upgrade your version of R, and both  ggplot2 and reshape2.  .  If I remember correctly your version of ggplot2 is loading reshape and plyr automatically as you mention below.  The newer version does not and one need to explicitly load reshape2.and plyr.  So  it is possible that  reshape_0;8.4 is masking reshape2_1.2.1 which can cause problems.

I'd suggest upgrading R,  , make sure that quantreg is not being loaded automatically, or if it is unattach it( see above|),  and then upgrade both reshape2 and ggplot to to the most recent versions and see what happens running the code from my first post.


Best of luck.

John Kane
Kingston ON Canada


> -----Original Message-----
> From: [hidden email]
> Sent: Sat, 30 Jun 2012 14:59:19 -0400
> To: [hidden email]
> Subject: Re: [R] Help
>
> The following is what I get when I run the code.
>
>
>> library(ggplot2)
> Loading required package: reshape
> Loading required package: plyr
>
> Attaching package: 'reshape'
>
> The following object(s) are masked from 'package:plyr':
>
>     rename, round_any
>
> Loading required package: grid
> Loading required package: proto
>> library(reshape2)
>
> Attaching package: 'reshape2'
>
> The following object(s) are masked from 'package:reshape':
>
>     colsplit, melt, recast
>
>>
>> A  <-  data.frame( m = (rep("A", 10)) , b=rnorm(10), c = rnorm(10))
>> B  <-  data.frame( m = (rep("B", 10)) , b=rnorm(10), c = rnorm(10))
>> C  <-  data.frame( m = (rep("C", 10)) , b=rnorm(10), c = rnorm(10))
>>
>> mydata  <-  rbind( A, B, C )
>> names(mydata)  <-  c( "group", "k1", "k2" )
>> mdata  <-  melt(mydata)
> Using group as id variables
>>
>> p  <-  ggplot( mdata , aes(variable, value , colour = variable )) +
> geom_boxplot() +
> +           facet_grid( group ~ .)
>> p
> Error in rq.fit.br(x, y, tau = tau, ...) : Singular design matrix
> In addition: Warning message:
> In is.na(rows) : is.na() applied to non-(list or vector) of type 'NULL'
>>
>
>
> And my session info is as below:
>
>
>> sessionInfo()
> R version 2.12.2 (2011-02-25)
> Platform: i386-apple-darwin9.8.0/i386 (32-bit)
>
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
>
> attached base packages:
> [1] grid      stats     graphics  grDevices utils     datasets  methods
> [8] base
>
> other attached packages:
> [1] quantreg_4.71 SparseM_0.89  reshape2_1.1  ggplot2_0.8.9 proto_0.3-9.2
> [6] reshape_0.8.4 plyr_1.6
>
> loaded via a namespace (and not attached):
> [1] stringr_0.5
>
>
> When I tried to load package ggplot, I was asked to also load some of the
> other packages, for example "plyr". Thanks.
>     Hannah
>
> 2012/6/30 Peter Ehlers <[hidden email]>
>
>> On 2012-06-30 07:04, John Kane wrote:
>>
>>>
>>>    Hi Hannah,
>>>    I have run both the original code and the code copied from the email
>>> and
>>>    both seem to work just fine.
>>>    I don't know why you are getting that error message.   Do you have
>>> both
>>>    ggplot2 and reshape2 loaded?  Still that should not give you the
>>> error
>>>    message you are getting. In fact given the data I supplied, I just
>>> don't
>>>    understand what it is trying to say.
>>>    I cannot even find a function [1]rq.fit.br.
>>>
>> [...]
>>
>> This function is in the quantreg *package*. So Hannah isn't
>> telling us the whole story.
>>
>> Peter Ehlers
>>
>>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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!

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Help

li li-13
Hi John,
  It worked. Thanks a lot!
    Hannah

2012/6/30 John Kane <[hidden email]>

> It looks like we have different versions of software loaded.
> I have R version 2.15.0 (2012-03-30)
>
> My packages.
> reshape2_1.2.1 ggplot2_0.9.0
>
> Hannah's packages.
> R version 2.12.2 (2011-02-25)
>  quantreg_4.71 SparseM_0.89  reshape2_1.1  ggplot2_0.8.9 proto_0.3-9.2
> [6] reshape_0.8.4 plyr_1.6
>
>
> It looks like quantreg is causing a problem since Peter says that the
> function is in the quantreg *package*.
>
> The first step would probably be to make sure that quantreg is not loaded
> and try the code again.  It "probably" would work with an older version of
> ggplot2 and the old version of reshape.  The command :
> unattach(package::quantreg) should work.
>
> Retry the code and see what happens.
>
> However I I think that you need to upgrade your version of R, and both
>  ggplot2 and reshape2.  .  If I remember correctly your version of ggplot2
> is loading reshape and plyr automatically as you mention below.  The newer
> version does not and one need to explicitly load reshape2.and plyr.  So  it
> is possible that  reshape_0;8.4 is masking reshape2_1.2.1 which can cause
> problems.
>
> I'd suggest upgrading R,  , make sure that quantreg is not being loaded
> automatically, or if it is unattach it( see above|),  and then upgrade both
> reshape2 and ggplot to to the most recent versions and see what happens
> running the code from my first post.
>
>
> Best of luck.
>
> John Kane
> Kingston ON Canada
>
>
> > -----Original Message-----
> > From: [hidden email]
> > Sent: Sat, 30 Jun 2012 14:59:19 -0400
> > To: [hidden email]
> > Subject: Re: [R] Help
> >
> > The following is what I get when I run the code.
> >
> >
> >> library(ggplot2)
> > Loading required package: reshape
> > Loading required package: plyr
> >
> > Attaching package: 'reshape'
> >
> > The following object(s) are masked from 'package:plyr':
> >
> >     rename, round_any
> >
> > Loading required package: grid
> > Loading required package: proto
> >> library(reshape2)
> >
> > Attaching package: 'reshape2'
> >
> > The following object(s) are masked from 'package:reshape':
> >
> >     colsplit, melt, recast
> >
> >>
> >> A  <-  data.frame( m = (rep("A", 10)) , b=rnorm(10), c = rnorm(10))
> >> B  <-  data.frame( m = (rep("B", 10)) , b=rnorm(10), c = rnorm(10))
> >> C  <-  data.frame( m = (rep("C", 10)) , b=rnorm(10), c = rnorm(10))
> >>
> >> mydata  <-  rbind( A, B, C )
> >> names(mydata)  <-  c( "group", "k1", "k2" )
> >> mdata  <-  melt(mydata)
> > Using group as id variables
> >>
> >> p  <-  ggplot( mdata , aes(variable, value , colour = variable )) +
> > geom_boxplot() +
> > +           facet_grid( group ~ .)
> >> p
> > Error in rq.fit.br(x, y, tau = tau, ...) : Singular design matrix
> > In addition: Warning message:
> > In is.na(rows) : is.na() applied to non-(list or vector) of type 'NULL'
> >>
> >
> >
> > And my session info is as below:
> >
> >
> >> sessionInfo()
> > R version 2.12.2 (2011-02-25)
> > Platform: i386-apple-darwin9.8.0/i386 (32-bit)
> >
> > locale:
> > [1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
> >
> > attached base packages:
> > [1] grid      stats     graphics  grDevices utils     datasets  methods
> > [8] base
> >
> > other attached packages:
> > [1] quantreg_4.71 SparseM_0.89  reshape2_1.1  ggplot2_0.8.9 proto_0.3-9.2
> > [6] reshape_0.8.4 plyr_1.6
> >
> > loaded via a namespace (and not attached):
> > [1] stringr_0.5
> >
> >
> > When I tried to load package ggplot, I was asked to also load some of the
> > other packages, for example "plyr". Thanks.
> >     Hannah
> >
> > 2012/6/30 Peter Ehlers <[hidden email]>
> >
> >> On 2012-06-30 07:04, John Kane wrote:
> >>
> >>>
> >>>    Hi Hannah,
> >>>    I have run both the original code and the code copied from the email
> >>> and
> >>>    both seem to work just fine.
> >>>    I don't know why you are getting that error message.   Do you have
> >>> both
> >>>    ggplot2 and reshape2 loaded?  Still that should not give you the
> >>> error
> >>>    message you are getting. In fact given the data I supplied, I just
> >>> don't
> >>>    understand what it is trying to say.
> >>>    I cannot even find a function [1]rq.fit.br.
> >>>
> >> [...]
> >>
> >> This function is in the quantreg *package*. So Hannah isn't
> >> telling us the whole story.
> >>
> >> Peter Ehlers
> >>
> >>
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] 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!
>
>
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Loading...