Re: [R] Packages - a great resource, but hard to find the right one

2007-11-23 Thread hadley wickham
> This is a strange argument. A good package will get a good review, which > may help it to become better. A review of a weak package can point out how > it can be fixed. Reviews will not become stale, just because packages are > frequently updated by their authors (like some that could be menti

Re: [R] ggplo2: fixed extent greater than data?

2007-11-23 Thread hadley wickham
On 11/23/07, thegeologician <[EMAIL PROTECTED]> wrote: > > Hi everyone! > > I'm digging into ggplot for some while now, I must say it's great! But - as > some others have posted before, and hadley knows very well himself - the > documentation is lacking some bits... > > So I have to pose that quest

Re: [R] Packages - a great resource, but hard to find the right one

2007-11-23 Thread hadley wickham
On 11/23/07, hadley wickham <[EMAIL PROTECTED]> wrote: > > Above all there are lots of packages. As the software editor of the > > Journal of Statistical Software I suggested we should review R > > packages. No one has shown any enthusiasm for this suggestion, but I >

Re: [R] Packages - a great resource, but hard to find the right one

2007-11-24 Thread hadley wickham
> What do you mean here? Surely all packages authors aim to provide reliable > and effective software. If they know that they are offering something > unstable, they should say so clearly. In fact, they should wait until it is > stable. Most R users are not researchers, but users. Now I'm begi

Re: [R] Packages - a great resource, but hard to find the right one

2007-11-25 Thread hadley wickham
> As for who should do the review, I wouldn't trust so much any user as I > would an organization such as the JSS. If the latter is not possible, the > first alternative is better than nothing. Of course, it doesn't have to be one or the other, but both could be included. It would be also nice to

Re: [R] Communicating from one function to another

2007-11-26 Thread hadley wickham
On 11/26/07, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > Others have already answered your direct question but consider that > what you may want without realizing it is object-oriented programming. I agree with Gabor, you're not actually looking for a global state, but a mutable object (explic

Re: [R] ggplot2 melt function "value"

2007-11-29 Thread hadley wickham
> > Hi:I recently started using the melt function and > > found that it is very useful and powerful,however I > > can't seem to find the way to change the default > > column header "value" to my custom column name. > > melted data are data frames. You can names[..]<-"myvalue" for renaming, but > m

Re: [R] Rating R Helpers

2007-11-30 Thread hadley wickham
A nice model might be http://www.workingwithrails.com/. It also suggests other possible measures of authority: * member of R core * packages written by/contributed to * R conference attended/presented at * contributer to wiki Hadley On 11/30/07, Doran, Harold <[EMAIL PROTECTED]> wrote: > Si

Re: [R] ggplot2: Choosing colours

2007-12-03 Thread hadley wickham
Hi Thierry, Have a look at http://had.co.nz/ggplot2/scale_identity. (The way you are currently doing it only works because you are not using any kind of grouping/facetting, and I'm thinking about adding an explicit message/warning for this case) Hadley On 12/3/07, ONKELINX, Thierry <[EMAIL PROT

Re: [R] using color coded colorbars for bar plots

2007-12-03 Thread hadley wickham
On 12/2/07, Jim Lemon <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Hi Jim, > > Thanks for getting back to me so quickly. > > > > I did look at color.legend, but that seems to plot colored blocks for > > the observations (in this case the mean) and not for the color.scale > > (which rep

Re: [R] using color coded colorbars for bar plots

2007-12-03 Thread hadley wickham
On 12/3/07, Bert Gunter <[EMAIL PROTECTED]> wrote: > ... but the best option is not to do this kind of technicolor extravaganza > at all! Yes, good point! And of a course of a scatterplot of mean vs variance will best reveal the relationship between the two variables. Hadley -- http://had.co.n

Re: [R] Multiple stacked barplots on the same graph?

2007-12-04 Thread hadley wickham
On Dec 4, 2007 11:19 AM, John Kane <[EMAIL PROTECTED]> wrote: > > --- Domenico Vistocco <[EMAIL PROTECTED]> wrote: > > > Perhaps this could be useful: > > > x=scan() > > 11.81 10.51 1.95 2.08 2.51 2.05 1.98 0.63 > > 0.17 0.20 > > 12.49 13.56 2.81 3.13 4.58 0.70 0.85 0.22 0.06 > > 0.0

Re: [R] Multiple stacked barplots on the same graph?

2007-12-04 Thread hadley wickham
On Dec 4, 2007 10:34 AM, Stéphane CRUVEILLER <[EMAIL PROTECTED]> wrote: > Hi, > > I tried this method but it seems that there is something wrong with my > data frame: > > > when I type in: > > > qplot(x=as.factor(Categorie),y=Total,data=mydata) > > It displays a graph with 2 points in each categor

Re: [R] color palette from red to blue passing white

2007-12-04 Thread hadley wickham
> Hmm, I would have recommended > > colorRampPalette(c('dark red','white','dark blue'), >space = "Lab") > > where the 'space = "Lab"' part also makes sure that a > "perceptually-based" space rather than RGB is used. > > I think the functions colorRamp() and (even more) > colo

Re: [R] Multiple stacked barplots on the same graph?

2007-12-05 Thread hadley wickham
gt; >0.32, 0.66, 0.06, 0.63, 0.38, 1.14, 6.17), chr2 = c(1.68, > >1.06, 1.55, 1.02, 4.57, 13.87, 7.85, 0.98, 1.06, 0.27, 1.2, > >9.88, 2.13, 2.53, 7.71, 0.4, 22.38, 0.71, 0.35, 0.09, 0.22, > >0.98, 3.9, 3.24, 0.22, 0.22, 0.49, 0.31, 2.79, 0.62, 1.33, > >

Re: [R] if/else for plot/lines?

2007-12-07 Thread hadley wickham
On Dec 7, 2007 4:28 AM, Roger Levy <[EMAIL PROTECTED]> wrote: > I'm interested in writing a function that constructs a new plot on the > current graphics device if no plot exists there yet, but adds lines to > the existing plot if a plot is already there. How can I do this? It > seems to me that

Re: [R] R help mailing system configuration change?

2007-12-07 Thread hadley wickham
On 12/6/07, 정 태훈 <[EMAIL PROTECTED]> wrote: > Hi, all; > > I got a reply for my previous several postings saying that I was > spamming the r-help mailing list. > I am very sorry to all subscribers if I did that. > But I've been reposting my message to the mailing list several times > because I didn

[R] [R-pkgs] fda, version 1.2.3

2007-12-07 Thread hadley wickham
e data (PCA, LDA, clustering, ...) have functional counterparts. More information about FDA can be found at http://www.psych.mcgill.ca/misc/fda/. Regards Hadley Wickham James Ramsey Spencer Graves ___ R-packages mailing list [EMAIL PROTECTED

Re: [R] book on regular expressions

2007-12-11 Thread hadley wickham
> Could someone recommend a good book on regular expressions with focus on > applications/use as it might relate to R. I remember there was a mention of > such a reference book recently, but I could not locate that message on the > archive. Mastering regular expressions by Jeffrey Friedl (http://

Re: [R] ggplot - Setting the y-scale in a bar plot

2007-12-11 Thread hadley wickham
Hi Pedro, What's the problem exactly? You'll need to compute the range yourself, and then use scale_y_continuous as you have below. (Also you can abbreviate the bar chart plotting command to: qplot(x, y, data=plotdata, geom="bar", stat="identity")) Hadley On 12/11/07, Pedro de Barros <[EMAIL P

Re: [R] book on regular expressions

2007-12-12 Thread hadley wickham
> I don't think anyone has mentioned the references given on the help page > ?regexp: they are a great deal more reliable than some of the third-party > write-ups that have been mentioned. They are good technical references, but I don't think they're very helpful for someone trying to learn regula

Re: [R] two-way categorical anova post-hoc data extraction

2007-12-12 Thread hadley wickham
> Hi list, > > I have a question regarding post-hoc extraction of data from a two-way > categorical anova. > > I have a categorical anova of this form: > > width ~ steepness + patchiness (4 steepness levels, 4 patchiness levels) > > This simple setup answers if for the widths I collected across di

Re: [R] use ggplot in a function to which a column name is given

2007-12-13 Thread hadley wickham
Hi Jiho, The key to solving this problem is to use aes_string instead of aes. Instead of the complicated munging that aes does to get the names of the variables, aes_string works directly with strings, so that: aes_string(x = "mpg", y = "wt") == aes(x = mpg, y = wt) So your function would look l

Re: [R] ggplot2: can not find "current.grobTree()"

2007-12-13 Thread hadley wickham
> Is the function "current.grobTree()" implemented in ggplot2? According to > the draft ggplot2 book, on page 43, we can get a list of all grobs with > current.grobTree(). But when I try that, I get 'Error: could not find > function "current.grobTree"'. Ooops - the book is now out of date. Paul M

Re: [R] ggplot - Setting the y-scale in a bar plot

2007-12-13 Thread hadley wickham
> PS: If you care to explain: why do all parameters in the code below > have a "." before the name, except precisely "limits"? I know it has > to do with "proto", but could not find out why this one was different. Not really - I started off with the convention that variables should start with a .

Re: [R] use ggplot in a function to which a column name is given

2007-12-13 Thread hadley wickham
> great! I knew you would have thought this through. That's perfect. As > always there's the trade-off between writing code and documenting the > code already written. In this case the trade-off turned toward the > code part I guess. > > Autodetection of strings by aes would be even greater but tha

Re: [R] Overlaying trellis xyplot on contourplot

2007-12-13 Thread hadley wickham
Hi Seth, An alternative would be to use ggplot2, http://had.co.nz/ggplot2: model <- function(a,b,c,X1,X2) { (exp(a + b*X1 + c*X2)) / (1 + exp(a + b*X1 + c*X2)) } g <- expand.grid(X1 = seq(0.40, 0.8,0.01), X2 = seq(0.03,0.99,0.03)) a <- -37.61 b <- 34.88 c <- 28.44 g$z<- model(a, b, c, g$X1,g$

Re: [R] Changing the origin in polar.plot in plotrix package

2007-12-15 Thread hadley wickham
Hi John, One alternative would be to use ggplot2 with a polar coordinate system: library(ggplot2) qplot(mpg, wt, data=mtcars) + coord_polar() qplot(mpg, wt, data=mtcars, ylim=c(3,4)) + coord_polar() etc. You can see more examples of polar coordinates at http://had.co.nz/ggplot2/coord_polar.html

Re: [R] improving a bar graph

2007-12-16 Thread hadley wickham
On 12/16/07, Bob Green <[EMAIL PROTECTED]> wrote: > Hello, > > Below is the code for a basic bar graph. I was seeking advice > regarding the following: > > (a) For each time period there are values from 16 people. How I can > change the colour value so that each person has a different colour, > wh

Re: [R] regression towards the mean, AS paper November 2007

2007-12-17 Thread hadley wickham
> This has nothing to do really with the question that Troels asked, > but the exposition quoted from the AA paper is unnecessarily > confusing. > The phrase ``Because X0 and X1 have identical marginal > distributions ...'' > throws the reader off the track. The id

Re: [R] bar plot colors

2007-12-17 Thread hadley wickham
> I have a question regarding colors in bar plots. I want to stack a > total of 18 cost values in each bar. Basically, it is six cost types and > each cost type has three components- direct, indirect, and induced > costs. I would like to use both solid color bars and bars with the > slanted lines

Re: [R] Scatterplot Showing All Points

2007-12-18 Thread hadley wickham
On 12/17/07, Jim Porzak <[EMAIL PROTECTED]> wrote: > Wayne, > > I am fond of the bagplot (think 2D box plot) to replace scatter plots > for large N. See > http://www.wiwi.uni-bielefeld.de/~wolf/software/aplpack/ and aplpack > in CRAN. The big drawback of the bagplot, like the boxplot, is that it's

Re: [R] Reshape Dataframe

2007-12-18 Thread hadley wickham
On 12/18/07, Bert Jacobs <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm having a bit of problems in creating a new dataframe. > Below you'll find a description of the current dataframe and of the > dataframe that needs to be created. > Can someone help me out on this one? library(reshape) dfm <- melt(

Re: [R] regression towards the mean, AS paper November 2007

2007-12-18 Thread hadley wickham
> Thanks for the example, Hadley. To me, this suggests we should stop > teaching histograms in Stat 101 and instead use quantile plots, which > give excellent results for n=100 and even surprisingly good results > for n=10: It all depends on what you're trying to do - I don't think histograms are

Re: [R] ggplot2 - getting at the grobs

2007-12-18 Thread hadley wickham
Hi Pedro, Could you be a bit more explicit about what you're trying to do? Have you read the last chapter of the draft ggplot book? Hadley On Dec 18, 2007 8:41 AM, Pedro de Barros <[EMAIL PROTECTED]> wrote: > Dear All, > > I continue trying to get several of my plotting functions to use > ggplo

Re: [R] plotting magnitude

2007-12-18 Thread hadley wickham
On Dec 18, 2007 2:06 PM, <[EMAIL PROTECTED]> wrote: > I am plotting fishing vessel positions and want these points to be > relative in size to the catch at that point. Is this possible? I am just > begining to use R and my search of the help section didnt help in this > area. Heres what Im using

Re: [R] Reshape Dataframe

2007-12-20 Thread hadley wickham
On Dec 20, 2007 4:56 PM, Bert Jacobs <[EMAIL PROTECTED]> wrote: > Hi, > > The problem is probably that my Var4, does not contain number but factor > information, and therefore I think Gabor's suggestion does not work. > The same holds for Hadley's solution with the functions melt/cast, where the >

Re: [R] Question about which kind of plot to use

2007-12-20 Thread hadley wickham
> Perhaps as long as you're learning a new plotting system, you might also > check out whether ggplot2 might be an option. > > I did a quick and dirty version (which I'm sure Hadley can improve and > also remind me how to get rid of the legend that shows the "3" that I > set the size to). > > Assum

Re: [R] New Cran Task View: ExperimentalDesign

2007-12-21 Thread hadley wickham
And the url is: http://cran.r-project.org/src/contrib/Views/ExperimentalDesign.html Hadley On 12/21/07, Ulrike Grömping <[EMAIL PROTECTED]> wrote: > Dear UseRs, > > the new Task View "ExperimentalDesign" (Title: Design of Experiments (DoE) & > Analysis of Experimental Data) has just been uploaded

Re: [R] geom_hline

2007-12-25 Thread hadley wickham
On Dec 25, 2007 9:32 PM, ONKELINX, Thierry <[EMAIL PROTECTED]> wrote: > Felipe, > > You'll need to define the limits yourself with scale_y_continuous. > > library(ggplot2) > p <- ggplot(mtcars, aes(x = wt, y=mpg)) + geom_point() > p + geom_hline(intercept=0) + scale_y_continuous(limits = c(0, > ma

Re: [R] scale_x_continuous

2007-12-26 Thread hadley wickham
> dt + scale_x_date() > dt + scale_x_date(format="%m/%d") > dt + scale_x_date(format="%W")+ You can only have one x scale - the last one overrides all the others. The date scale (currently) doesn't have a limits setting (what units would you specify it in?), but you could use subset to plot onl

Re: [R] Date formats

2007-12-30 Thread hadley wickham
On Dec 30, 2007 10:47 AM, Peter Dalgaard <[EMAIL PROTECTED]> wrote: > Gabor Grothendieck wrote: > > Read the warning in ?ifelse > Yep. > > And, yes, it is annoying that ifelse() strips attributes, including > class, but it is one of those things that have been in the S languages > "forever", and no

Re: [R] reversing the scale on ggplot

2008-01-02 Thread hadley wickham
Hi Pedro, Sorry for missing this email - the good news is that in the next version of ggplot (hopefully coming out in the next few days), you'll be able to do: qplot(x, y, data=plotdata) + scale_x_reverse() qplot(x, y, data=plotdata) + scale_y_reverse() to get reversed scales Hadley On Oct 31,

Re: [R] Confidence Inteval for regression curve.

2008-01-05 Thread hadley wickham
On Jan 5, 2008 7:45 PM, Milton Cezar Ribeiro <[EMAIL PROTECTED]> wrote: > Dear all, > > I have a dataset which I need to estimate the regression model and plot the > estimated curve two other curves with low and high confidence interval > (CI=95%). How can I do that? The easiest way is to use th

Re: [R] Cumulative sum of vector

2008-01-06 Thread hadley wickham
On Jan 5, 2008 8:32 AM, Keith Jones <[EMAIL PROTECTED]> wrote: > Hi, > > Maybe I have not been looking in the right spot, but, I have not been > able to fine a command to automatically calculate the running > cumulative sum of a vector. Is there such a command? Try help.search("cumulative sum")

[R] Installing R on ubuntu dapper

2008-01-06 Thread hadley wickham
I followed the instructions at http://cran.r-project.org/bin/linux/ubuntu/README.html, but I'm getting the following error: ~: sudo apt-get install r-base Reading package lists... Done Building dependency tree... Done Some packages could not be installed. This may mean that you have requested an i

Re: [R] Installing R on ubuntu dapper

2008-01-07 Thread hadley wickham
On 1/7/08, Emmanuel Charpentier <[EMAIL PROTECTED]> wrote: > hadley wickham a écrit : > > I followed the instructions at > > http://cran.r-project.org/bin/linux/ubuntu/README.html, but I'm > > getting the following error: > > > > ~: sudo apt-get inst

Re: [R] I need arguments pro-S-PLUS and against SAS...

2008-01-07 Thread hadley wickham
> errors in the data usually because I know the data. I find errors > because I can say things like > > library(Hmisc) > datadensity(mydata) # show all raw data in small rug plots > hist.data.frame(mydata) # postage-stamp size histograms of all > variables in dataset > latex(describe(my

Re: [R] 4 dimensional graphics

2008-01-10 Thread hadley wickham
On Jan 10, 2008 8:36 AM, Petr PIKAL <[EMAIL PROTECTED]> wrote: > Dear all > > I want to display 4 dimensional space by some suitable way. I searched > CRAN and found miscellaneous 3 dim graphics packages which I maybe can > modify but anyway I am open to any hint how to efficiently display data > l

Re: [R] ggplot2, coord_equal and aspect ratio

2008-01-10 Thread hadley wickham
On Jan 10, 2008 6:16 PM, jiho <[EMAIL PROTECTED]> wrote: > Hi everyone, Hi Hadley, > > I am a heavy user of coord_equal() in ggplot2 since most of my data is > spatial, on x,y coordinates. Everything works. However by enforcing an > aspect ratio of 1 for the plotting region, coord_equal() usually >

[R] [R-pkgs] New version of ggplot2: 0.5.7

2008-01-11 Thread hadley wickham
ggplot2 ggplot2 is a plotting system for R, based on the grammar of graphics, which tries to take the good parts of base and lattice graphics and avoid bad parts. It takes care of many of the fiddly details that make plotting a hassle (l

Re: [R] Ceiling to the nearest ten?

2008-01-14 Thread hadley wickham
On 1/14/08, Jim Price <[EMAIL PROTECTED]> wrote: > > A suggestion for a family of such functions: > > > ceilGenerator <- function(num) > function(x) num * ceiling(x / num) > > > ceil10 <- ceilGenerator(10) > ceil20 <- ceilGenerator(20) > > > ceil10(1:10 * 4) > ceil20(1:10 * 4) libraray(res

Re: [R] Overlay plots from different data sets using the Lattice package

2008-01-14 Thread hadley wickham
On Jan 14, 2008 7:30 PM, Erin Steiner <[EMAIL PROTECTED]> wrote: > #After spending the entire day working on this question, I have > decided to reach out for support: > > #I am trying to overlay a densityplot from one data set over a > histogram of another, if I were to plot the two individually, t

Re: [R] unload & reload a (new version of a) package

2008-01-14 Thread hadley wickham
On Jan 14, 2008 5:48 PM, Harte, Thomas P <[EMAIL PROTECTED]> wrote: > i'm putting the final touches on a package that i'm developing and i > noticed > that if i detach the package, and then re-build & re-install it (using R > CMD) > then I can't get the newer version of the package to load in the >

Re: [R] ggplot and spec.pgram

2008-01-15 Thread hadley wickham
Currently ggplot doesn't support any interactivity. What sort of interaction were you looking for with the periodogram? It might be possible to do something with rggobi. Hadley On Jan 15, 2008 10:38 AM, stephen sefick <[EMAIL PROTECTED]> wrote: > Any Ideas to get an interactive periodogram? > >

Re: [R] navigating ggplot viewports

2008-01-15 Thread hadley wickham
Hi Felix, I'm a bit stumped too - it's been a while since I've played around with viewports in ggplot. I have a feeling that this might be due to an old bug in grid that I thought had been fixed - you can't downViewport to a viewport underneath a frame grob. I've cc'd Paul in the hope that he mi

Re: [R] Overlay plots from different data sets using the Lattice package

2008-01-15 Thread hadley wickham
On Jan 15, 2008 12:27 PM, Dieter Menne <[EMAIL PROTECTED]> wrote: > hadley wickham gmail.com> writes: > > > qplot(vals, ..density.., data = data.frame.A, geom="histogram", facets > > = factor.1 ~ factor.2, binwidth = 1) + geom_density(data=data.frame.B)

Re: [R] Graphical output: dials and meters for a dashboard?

2008-01-15 Thread hadley wickham
> I'm new to R and am evaluating it to see whether it would be an appropriate > tool to create a "dashboard" (a graphical statistical summary page). Could > someone tell me if it is possible to display data as dials or meters. e.g. > the four dials here: http://www.pentaho.com/images/snap_dashb

Re: [R] things that are difficult/impossible to do in SAS or SPSSbut simple in R

2008-01-17 Thread hadley wickham
> Previously I used SAS for 23 years and now R/S-Plus for 17. SAS is > effective for large datasets (in my work > 500,000 subjects) but except > for that, R is far superior to SAS for data management and manipulation. > Just four of the reasons are that you can > > - merge data frames multiple w

Re: [R] things that are difficult/impossible to do in SAS or SPSSbut simple in R

2008-01-17 Thread hadley wickham
"Happy families are all alike; every unhappy family is unhappy in its own way." Leo Tolstoy and every messy data is messy in its own way - it's easy to define the characteristics of a clean dataset (rows are observations, columns are variables, columns contain values of consistent types). If you

Re: [R] Converting plots to ggplot2

2008-01-17 Thread hadley wickham
On Jan 17, 2008 9:53 AM, Thompson, David (MNR) <[EMAIL PROTECTED]> wrote: > Hello Hadley, > > I am trying to reproduce the following with ggplot: > a <- seq(0, 360, 5)*pi/180 ; a > ac <- sin(a + (45*pi/180)) + 1 ; ac > plot(a, ac, type='b', xaxt = "n") > axis(1, at=seq(0,6,1), label

Re: [R] histogram with NAs

2008-01-18 Thread hadley wickham
> "Typical plots with vertical bars are not histograms. Consider barplot > or plot(*, type = "h") for such bar plots. ". But no worry, I've mixed > them up myself a number of times. Or you can use ggplot2, which will do the right thing regardless of whether you have continuous or categorical data:

Re: [R] image/area plot

2008-01-18 Thread hadley wickham
Do you have an example graphic that shows what you're trying to create? I can't figure out if you want something like a square pie chart (aka waffle chart), a stacked barchart, a levelplot, or something else. Hadley On Jan 18, 2008 6:06 AM, Marta Rufino <[EMAIL PROTECTED]> wrote: > Dear R users,

Re: [R] things that are difficult/impossible to do in SAS or SPSSbut simple in R

2008-01-18 Thread hadley wickham
On Jan 18, 2008 1:19 PM, Jeffrey J. Hallman <[EMAIL PROTECTED]> wrote: > Frank E Harrell Jr <[EMAIL PROTECTED]> writes: > > > Rob Robinson wrote: > >> I wonder if those who complain about SAS as a programming environment have > >> discovered SAS/IML which provides a programming environment akin to

Re: [R] recoding one variable into another - but differently for different cases

2008-01-22 Thread hadley wickham
No one else mentioned this, but if those 99s represent missings, you should be using NA not a special numeric value. Hadley On Jan 22, 2008 5:40 PM, Dimitri Liakhovitski <[EMAIL PROTECTED]> wrote: > Thanks a lot, everyone! > Dimitri > > > On 1/22/08, Gabor Grothendieck <[EMAIL PROTECTED]> wrote:

Re: [R] help with levelplot()

2008-01-22 Thread hadley wickham
On Jan 22, 2008 8:39 PM, dxc13 <[EMAIL PROTECTED]> wrote: > > useR's, > > I want to create a "movie" of a sin function (from 0 to pi/2) using > levelplot() in the lattice package. I basically want to create 20 or so > plots of the sin function starting with an amplitude of 0 and ending at > amplit

Re: [R] Problem with geom_line

2008-01-23 Thread hadley wickham
On Jan 23, 2008 3:29 AM, Pilar Loren <[EMAIL PROTECTED]> wrote: > Hi!, I need help, I have a problem with geom_line function because I have > this error: > > > df >LENGTH LAT > 091639 10.002 42.26282 > 091640 30.808 42.26834 > 091641 21.591 42.31689 > 091642 22.030 41.53246 > 091643 22

Re: [R] ggplot / reshape: basic usage

2008-01-23 Thread hadley wickham
On Jan 23, 2008 10:44 AM, baptiste Auguié <[EMAIL PROTECTED]> wrote: > Hi, > > I've been trying to do the following simple thing: given a data.frame, > > > library(reshape) > > library(ggplot2) > > > > df <- data.frame(x=c(1:10),y=sin(1:10),z=cos(1:10)) > > dfm<-melt(df, id=c("x"), measured=c("y","

Re: [R] using complete.cases() with nested factors

2008-09-04 Thread hadley wickham
On Thu, Sep 4, 2008 at 4:19 PM, Ken Knoblauch <[EMAIL PROTECTED]> wrote: > Andrew Barr gmail.com> writes: >> This maybe a newbie question. I have a dataframe > that looks like the sample >> at the bottom of the email. I have monthly > precipitation data from several >> sites over several years.

Re: [R] Density estimates in modelling framework

2008-09-05 Thread hadley wickham
Thanks for all your replies. The suggestions I got were: * gss * logspline * locfit I ended up using locfit because the interface was just right for my needs, and it was faster than the alternatives. Hadley On Fri, Aug 29, 2008 at 2:03 PM, hadley wickham <[EMAIL PROTECTED]> wrote

Re: [R] ggplot2: Changes to grobs not saved to file output

2008-09-05 Thread hadley wickham
Unfortunately it's not particularly easy in the current version. In the next version, you can do: p <- qplot(wt, mpg, data=mtcars, colour=cyl) # Get the plot grob grob <- ggplotGrob(p) # Modify it place grob <- geditGrob(grob, gPath("strip","label"), gp=gpar(fontface="bold")) # Draw it pdf(...)

Re: [R] casting help please

2008-09-05 Thread hadley wickham
Hi David, Does getting rid of the missings help? prices <- prices[complete.cases(prices), ] Also, you shouldn't need add.missing=TRUE - what are you trying to do? Hadley On Fri, Sep 5, 2008 at 12:12 PM, <[EMAIL PROTECTED]> wrote: > I have a data.frame which I believe is melted already and am

Re: [R] Axis tick label format and rotation

2008-09-07 Thread hadley wickham
Hi Kurt, > Please tell me how to format data in a data frame so when currency amount is > displayed in a chart the axis tick labels contain leading $ signs. The easiest way is add a custom scale: vals <- seq(0, 100, by = 10) qplot(...) + scale_x_continuous(breaks = vals, labels = paste("$", vals

Re: [R] plotting group means

2008-09-09 Thread hadley wickham
On Tue, Sep 9, 2008 at 6:56 AM, ONKELINX, Thierry <[EMAIL PROTECTED]> wrote: > Dear Erich, > > Have a look at ggplot2 > > library(ggplot2) > dataset <- expand.grid(x = 1:20, y = factor(LETTERS[1:4]), value = 1:10) > dataset$value <- rnorm(nrow(dataset), sd = 0.5) + as.numeric(dataset$y) Or with st

Re: [R] plotting group means

2008-09-09 Thread hadley wickham
On Tue, Sep 9, 2008 at 8:38 AM, Erich Studerus <[EMAIL PROTECTED]> wrote: > Thanks for all the suggestions, but it seems, that all these functions need > a rearrangement of my data, since in my case, the dependent variables are in > different columns. The error.bars.by-function seems to be the only

Re: [R] exporting tapply objects to csv-files

2008-09-09 Thread hadley wickham
On Tue, Sep 9, 2008 at 3:48 AM, Kunzler, Andreas <[EMAIL PROTECTED]> wrote: > Dear Everyone, > > I try to create a cvs-file with different results form the table function. > > Imagine a data-frame with two vectors a and b where b is of the class factor. > > I use the tapply function to count a for

Re: [R] ggplot2: edge outlines on points

2008-09-10 Thread hadley wickham
Hi Adam, The next version of ggplot2 supports the build-in R plotting symbols that have different fills and borders, so you can do something like: geom_point(aes(colour=TRT), fill="red", colour="black", shape=21) Otherwise in the current version you can do: ggplot(data.frame(x = runif(20), y =

Re: [R] mixed model MANCOVA

2008-09-10 Thread hadley wickham
On Mon, Sep 8, 2008 at 1:06 PM, Erika Crispo <[EMAIL PROTECTED]> wrote: > Hello, > > I need to perform a mixed-model (with nesting) MANCOVA, using Type III sums > of squares. I know how to perform each of these types of tests individually, > but I am not sure if performing a mixed-model MANCOVA i

Re: [R] All possible pairs of two variables

2008-09-11 Thread hadley wickham
On Wed, Sep 10, 2008 at 11:34 PM, Ron Michael <[EMAIL PROTECTED]> wrote: > I have two variables (x,y) : > > x : it takes all integer values from 0 to y and, > y : takes all values from 0, 10 > > I am looking for some R code to find all possible pairs of (x,y). Can anyone > please help me? ?expand

[R] Truncating dates (and other date-time manipulations)

2008-09-11 Thread hadley wickham
Dear all, I've been struggling to perform common operations on dates that I need to be able to correct draw date-time scales - in particular I need to be able to round/truncate/ceiling dates to arbitrary precision - e.g. to weeks, months or years (or multiples thereof). I haven't been able to fin

Re: [R] Truncating dates (and other date-time manipulations)

2008-09-11 Thread hadley wickham
> I'm wrapping boost date_time into an R package. I'll post it up to > cran shortly. > > http://www.boost.org/doc/libs/1_36_0/doc/html/date_time.html > > I'm not sure if that is what you are looking for, but there are a lot > of useful utilities in this library. Looks useful, but I didn't see any

Re: [R] Truncating dates (and other date-time manipulations)

2008-09-11 Thread hadley wickham
On Thu, Sep 11, 2008 at 12:04 PM, Whit Armstrong <[EMAIL PROTECTED]> wrote: > probably not pre-canned routines for that, but very easy to implement > with the tools provided in the library. > > Looks like most of what you want to do is fairly simple and not worth > the trouble of involving c++. > >

Re: [R] Truncating dates (and other date-time manipulations)

2008-09-11 Thread hadley wickham
On Thu, Sep 11, 2008 at 11:00 AM, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > See ?cut.Date > > In the zoo package see: > ?as.yearmon > ?as.yearqtr > ?aggregate.zoo > > and the many examples in: > ?plot.zoo > ?xyplot.zoo > as well as the three zoo vignettes. > > Also in the xts package look at

Re: [R] Truncating dates (and other date-time manipulations)

2008-09-11 Thread hadley wickham
On Thu, Sep 11, 2008 at 2:26 PM, Jeffrey J. Hallman <[EMAIL PROTECTED]> wrote: > Look at the ti (Time Index) class in package tis. Here's some examples I > just did: >> x <- Sys.Date() >> x > [1] "2008-09-11" >> ti(x, "wsaturday") ## a ti for the week that x falls into > [1] 20080913 > clas

Re: [R] Truncating dates (and other date-time manipulations)

2008-09-11 Thread hadley wickham
> Hadley, > > What's wrong with: > > dates <- structure(c(8516, 8544, 8568, 8596, 8609, 8666, 8701, 8750, > 8754, 8798, 8811, 8817, 8860, 8873, 8918, 8931, > 8966, 9020, 9034, 9056), class = "Date") > > The problem is this: > as.Date(cut.Date(dates, "day"))

Re: [R] Truncating dates (and other date-time manipulations)

2008-09-11 Thread hadley wickham
>> I don't think that cut.Date helps because I want to make a new series, >> not divide up an existing one, similarly with to.period. as.yearmon, > > Use cut.Date like this (assuming the dates variable as in your post): > > r <- as.Date(cut(range(dates), "month")) > > > # every month > seq(r[1], r

Re: [R] Truncating dates (and other date-time manipulations)

2008-09-11 Thread hadley wickham
> The problem is trying to force everything into Date class. If you really > want a monthly series you probably want yearmon rather than Date > class Could you give a bit more detail about why you think this is the best way to proceed? To me, it seems like it's easiest to have one date class whi

Re: [R] plotCI -- multiple plots on same graph

2008-09-12 Thread hadley wickham
> I have a bunch of lines I want to plot using plotCI() > > What Id like to know is, how can I connect the points with a line and how > can I print multiple lines on the same graph? You might want to have a look at ggplot2, e.g. http://had.co.nz/ggplot2/geom_errorbar.html, for an alternative way t

Re: [R] Truncating dates (and other date-time manipulations)

2008-09-12 Thread hadley wickham
On Fri, Sep 12, 2008 at 10:53 AM, Jeff Ryan <[EMAIL PROTECTED]> wrote: > > I'm still not entirely sure I follow the desired usage, as the original post > made no reference to ggplot2, but as Gabor mentioned the yearmon etc stuff > is quite useful. Well, I said "I need to be able to correct draw da

Re: [R] Scatterplot with data grouped by color

2008-09-12 Thread hadley wickham
On Fri, Sep 12, 2008 at 5:29 PM, Amanda Young <[EMAIL PROTECTED]> wrote: > Hi, > I am a complete R rookie so this question is probably really simple > but I haven't found an answer on the web that I can understand. > > My data frame has 3 columns, A, B and C. A and B have numbers (about > 8000 rows

Re: [R] ggplot2 - deprecated guide= argument in

2008-09-17 Thread hadley wickham
On Wed, Sep 17, 2008 at 5:34 AM, Pedro Barros <[EMAIL PROTECTED]> wrote: > > In the help for scale_fill_identity, it is written > ## Not run: > colour <- c("red","green","blue","yellow") > qplot(1:4, 1:4, fill=colour, geom="tile") > qplot(1:4, 1:4, fill=colour, geom="tile")

Re: [R] Stacked Area Plot

2008-09-17 Thread hadley wickham
On Wed, Sep 17, 2008 at 1:01 PM, Josip Dasovic <[EMAIL PROTECTED]> wrote: > Hi: > > I've searched the archives and the Internet for hours but have yet to find a > way to do stacked area plots (like the kind in Excel) in R. I think that > polygon may work but it would require a bit of manipulatio

Re: [R] creating rainbow gradients

2008-09-17 Thread hadley wickham
On Wed, Sep 17, 2008 at 3:58 PM, Gillian Silver <[EMAIL PROTECTED]> wrote: > Hi, how can I create a rainbow gradient in R? For example, let's say I have > a plot of y = x...and I want the plot to go from red -> orange -> yellow -> > green -> blue -> etc. Why would you want to? See http://epub.wu-

Re: [R] matrix to list

2008-09-17 Thread hadley wickham
On Wed, Sep 17, 2008 at 8:52 PM, Pinder, Adrian <[EMAIL PROTECTED]> wrote: > Hi, can someone please tell me how to convert a square matrix to a list in R? > > i.e. I want to convert from: > >a b c > a 1 1 1 > b 2 2 2 > c 3 3

Re: [R] ggplot2 - deprecated guide= argument in

2008-09-18 Thread hadley wickham
> As for now, I have not yet delved deep enough into the new version to be > sure if I like it or not. It's just that I like the freedom to choose, and > the previous form was great. Any chance you may put it back as an optional > parameter? I doubt it, but you can override the defaults as follows

Re: [R] Reporting with down and across variables

2008-09-18 Thread hadley wickham
On Thu, Sep 18, 2008 at 10:03 AM, Matthew Pettis <[EMAIL PROTECTED]> wrote: > [Reposting with changed example] > Hi, > > I want to take the dataframe df generated below and reshape the data with > column names being w, x, y, and the different levels of z. The values under > the different levels of

Re: [R] Problem installing packages in newer versions of R

2008-09-18 Thread hadley wickham
Hi Miha, One tip for diagnosing build problems is to ignore all warnings and look for the first error. In your case it's: init.c:2:15: error: R.h: No such file or directory init.c:3:24: error: Rinternals.h: No such file or directory Which possibly suggests that you don't have the necessary head

Re: [R] Suggestion: Re: Fatal error .RData

2008-09-18 Thread hadley wickham
And does it need to be a fatal error? load("test.txt") doesn't produce a fatal error even though the file clearly isn't in the correct format. Or is there the possibility that loading a malformed rdata file introduces memory corruption? On Thu, Sep 18, 2008 at 9:55 AM, Henrik Bengtsson <[EMAIL PR

Re: [R] Reporting with down and across variables

2008-09-18 Thread hadley wickham
the variable > has to be named 'value'? > > On Thu, Sep 18, 2008 at 10:08 AM, hadley wickham <[EMAIL PROTECTED]> wrote: >> On Thu, Sep 18, 2008 at 10:03 AM, Matthew Pettis >> <[EMAIL PROTECTED]> wrote: >>> [Reposting with changed example] >>

Re: [R] reproduce this graph in ggplot2 (code and data included)

2008-09-19 Thread hadley wickham
Here's one way: qplot(degreedays, therms, data=heating, colour = Location, shape = Location) + geom_smooth(method = "lm", fullrange = T, se = F) Hadley On Fri, Sep 19, 2008 at 12:45 PM, Juliet Hannah <[EMAIL PROTECTED]> wrote: > How can I reproduce this graph in ggplot2 (regression lines and da

<    6   7   8   9   10   11   12   13   14   15   >