Re: [R] what's the R code for wavelet decomposition (Haar transformation)?

2009-10-19 Thread Chris Friedl
The wavethresh package on CRAN has Haar wavelets. Zhen Li wrote: > > Dear all, > > Using R function "dwt", it seems that I cannot specify the wavelet > transformation like Haar. What's the R code for wavelet decomposition > which allows me to specify Haar wavelet transformation? Of course, i

[R] ggsave to .png bug in ggplot2 (?)

2009-08-19 Thread Chris Friedl
Text is really small and legend boxes are huge in this plot when saved to .png with ggsave. Plot is correct (i.e. looks the same as the screen) when saved with dev.print. Saving to .pdf with ggsave give the correct output. I'm a noob at ggplot2 so this may be user error rather than a bug. However

Re: [R] ggplot2 legend problem

2009-08-19 Thread Chris Friedl
ven body of > data. > ~ John Tukey > > -Oorspronkelijk bericht- > Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > Namens hadley wickham > Verzonden: woensdag 19 augustus 2009 14:18 > Aan: Chris Friedl > CC: r-help@r-project.org > Onderwerp

Re: [R] histogram scaling

2009-08-19 Thread Chris Friedl
Hey, Rajesh I bit light on detail here. Being a mind reader is not an R-help prerequisite. However since I have been working on histograms today and you've just posted a question using ggplot, let me guess that its ggplot you are refering to. Then here is an example, which you can find in my post

Re: [R] ggplot 2 semi-transparency error

2009-08-18 Thread Chris Friedl
I really don't know anything much about this but I tried "device=pdf" (no-quotes) and I got a pdf file with transparent plots. ?device.print gives help with some links to other devices hth rajesh j wrote: > > Hi, > I used the command ggplot as follows... > p<-ggplot(a,aes(x=a$V1,colour=a$V2,f

Re: [R] ggplot2 legend problem - SOLVED

2009-08-18 Thread Chris Friedl
Trawling the online and pdf manuals for density plots further I found a reference to position and tried it with histograms. It worked! So here is an example that gives me overlapping histograms, alpha transparency so they can both be seen in the area of overlap, and with properly labelled and col

Re: [R] ggplot2 legend problem

2009-08-18 Thread Chris Friedl
Still struggling with this. A further example using a slightly different organisation of the data. The factors "A" and "B" are included in the dataframe in an attempt to get ggplot to generate a legend automatically. x <- data.frame(value=rnorm(5000, mean=0), case="A") y <- data.frame(value=rnorm

[R] ggplot2 legend problem

2009-08-18 Thread Chris Friedl
I'm trying to overlay two histograms using transparency to enable viewing of multiple distributions on a single scale. So far ggplot2 seems to do what I want. However I'm having a problem generating the legend coloring appropriate to each distribution in the plot. Here is a test case to show my b

Re: [R] How to exclude insignificant intercepts using "step" function

2009-06-23 Thread Chris Friedl
Dieter Menne wrote: > > > > David Winsemius wrote: >> >> >> On Jun 23, 2009, at 3:08 AM, Chris Friedl wrote: >> The point is that in very few applications can one legitimately >> "exclude" an intercept. In this situation (stepwise regr

Re: [R] How to exclude insignificant intercepts using "step" function

2009-06-23 Thread Chris Friedl
David Winsemius wrote: > > > OK, this is on your head. Make sure you know how not to burn yourself > with this: > > > model <- y ~ x1*x2 + one -1 > > data2$one <- 1 > > by(data2, data2$grp, function(x) step(lm(model, data=x))) > > Lets the intercept just be another variable. > > > Dav

Re: [R] How to exclude insignificant intercepts using "step" function

2009-06-23 Thread Chris Friedl
I appreciate that you are trying to help me but I don't fully understand your point. At one point I did say "... the intercept is not significantly different from zero". I admit I also said "dropping the intercept term" which in my loose application of terminology means force the intercept to a va

[R] How to exclude insignificant intercepts using "step" function

2009-06-22 Thread Chris Friedl
I posted this question way down at teh end of another thread realted to an error in step, but that was stupid since it really is another matter altogether. I should have posted it separately, as I have now done. The code below creates a data.frame comprising three marginally noisy surfaces. The c

Re: [R] Error when using step

2009-06-22 Thread Chris Friedl
David Winsemius wrote: > > > ... > > Perhaps: > > by(data2, data2$grp, function(x) step(lm(model, data=x))) > > > David Winsemius, MD > Heritage Laboratories > West Hartford, CT > > Perhaps ;) You know of course that this worked. It took a moment to understand the screen output bec

Re: [R] Error when using step

2009-06-22 Thread Chris Friedl
Dieter Menne wrote: > > ... > > Looks like an environment problem. I could not find a workaround quickly, > but you might have a look at > > http://finzi.psych.upenn.edu/R/Rhelp02a/archive/16599.html > > We call it "Ripley's Game" here, because variants of it can help you quite > often. >

[R] Error when using step

2009-06-21 Thread Chris Friedl
I have two questions about the built-in function step. Ultimately I want to apply a lm fitting and subsequent step procedure to thousands of data sets groups by a factor defined as a unique ID. Q1. The code below creates a data.frame comprising three marginally noisy surfaces. The code below fail

Re: [R] Re gression by groups questions

2009-06-18 Thread Chris Friedl
model to find the right coeffs: > > y ~ grp:x1:x2 + grp:x1 + grp:x2 + grp - 1 > > It works for me. Notice in summary() that the coefficients for the x1:x2 > interaction are not significantly different from 0 in groups A and B, > which is what we expected. > > HTH, > > Xav

Re: [R] Re gression by groups questions

2009-06-18 Thread Chris Friedl
regression model to find the right coeffs: y ~ grp:x1:x2 + grp:x1 + grp:x2 + grp - 1 It works for me. Notice in summary() that the coefficients for the x1:x2 interaction are not significantly different from 0 in groups A and B, which is what we expected. HTH, Xavier Chris Friedl wrote: >

[R] Re gression by groups questions

2009-06-17 Thread Chris Friedl
I have a large dataset grouped by a factor and I want to perform a regression on each data subset based on this factor. There are many ways to do this, posted here and elsewhere. I have tried several. However I found one method posted on the R wiki which works exactly as I want, and I like the ele

Re: [R] ggplot2 - Problem with grid plot

2008-03-04 Thread Chris Friedl
ONKELINX, Thierry wrote: > > Dear Chris, > > You'll need to add information on the facet factor (color) to the > medians dataset. > > library(ggplot2) > medians <- aggregate(diamonds$price, list(cut = diamonds$cut, color = > diamonds$color), median) > ggplot(data=diamonds, aes(x=price)) + geo

[R] ggplot2 - Problem with grid plot

2008-03-04 Thread Chris Friedl
Hi R-help I'm trying to create a grid plot in which each plot in the grid contains two density plots (colored by factor) and two vertical lines at the respective medians (also colored by the factor). Using the diamonds dataset as an example, the following commands give me price density plots by

Re: [R] ggplot2 boxplot confusion

2008-02-28 Thread Chris Friedl
Hey thanks Thierry! I learned two things here ... position="identity" AND x=dummy. Can I ask where you learned these things. I've read a lot of the online reference manual, "the book", other presentations of ggplot2 and don't recall seeing these, especially the x=dummy reference. Does this come

Re: [R] ggplot2 boxplot confusion

2008-02-27 Thread Chris Friedl
hadley wrote: > >> I noticed the coord flip problem during my ggplot investigations. Is >> this >> something I can override by getting into the code? > > However, there is one geom that is parameterised in the opposite > direction: geom_vline. So your second option "just draw the density > p

Re: [R] ggplot2 boxplot confusion

2008-02-27 Thread Chris Friedl
Hi Hadley First off, thanks for ggplot2 and everything that bringing it to life and sustaining it entails. I noticed the coord flip problem during my ggplot investigations. Is this something I can override by getting into the code? On the coord flipping problem I was thinking to grab the densit

Re: [R] ggplot2 boxplot confusion

2008-02-27 Thread Chris Friedl
Thierry 1. ggplot(mydata, aes(y = VALUE, x = SERIES)) + geom_boxplot() + facet_grid(.~ ID) creates a grid with three ID columns (ID1, ID2, ID3) and six SERIES columns within each ID column with two boxplots in each ID column (C10, C2) (C15, C4), (C20, C8). I was aiming for a grid with ID column

Re: [R] ggplot2 boxplot confusion

2008-02-27 Thread Chris Friedl
Thanks Thierry. But this leads to a couple more questions if you don't mind. 1. I tried to extend your example to a grid by the facet_grid command with the aim of getting a boxplot of VALUE according to two factors SERIES and ID. However whatever syntax I use give me an error. For example: ggpl

Re: [R] how to specify ggplot2 facet plot order

2008-02-27 Thread Chris Friedl
Hi Thierry thanks for your help. I've been searching the R-help archives for posts by you and Hadley as a way to learn ggplot details so I appreciate your help to the R community. I wasn't aware of the levels option in the factors function. In my real application I get the data using read.csv an

[R] how to specify ggplot2 facet plot order

2008-02-26 Thread Chris Friedl
Hi, new to R and ggplot2. I've been trying to get a facet plot in which the order of the facets is as I require, rather than ordered numerically, alphabetically, by Roman numerals, mean (answers to these were posted here after much searching). Here's some test code to demonstrate what I get. seri

[R] ggplot2 boxplot confusion

2008-02-26 Thread Chris Friedl
Ultimately my aim is to get a plot of density faceted by 2 factors with a horizontal boxplot overlaid on each density plot in the grid to indicate summary stats. So I've been experimenting with creating boxplots and density plots. Here's some representative data. series = c('C2','C4','C8','C10','