Re: [R] Advanced Filtering problem

2008-06-19 Thread hadley wickham
Hi Tyler, > I've attached 100 rows of a data frame I am working with. > I have one factor, id, with 27 levels. There are two columns of reference > data, x and y (UTM coordinates), one column "date" in POSIXct format, and > one column "diff" in times format (chron package). > > What I am trying t

Re: [R] Programming Concepts and Philosophy

2008-06-20 Thread hadley wickham
> However, on a more fundamental "programming philosophy" note, the fact > that R does not allow multiple references to one object is a limitation. > One of the fundamental principles of good programming is that there > should be a one-to-one correspondence between instances in the program > and ob

Re: [R] Programming Concepts and Philosophy

2008-06-20 Thread hadley wickham
2008/6/20 [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > On 20 июн, 11:06, Wacek Kusnierczyk > <[EMAIL PROTECTED]> wrote: >> the result may be that the more beautiful the code, the more the performance >> sucks. > > Sad but true. If you do nothing to your code, in 18 months time its performance will hav

Re: [R] a high-level command for drawing a multiple series graph with each series having a label

2008-06-21 Thread hadley wickham
On Sat, Jun 21, 2008 at 1:00 AM, Mark Farnell <[EMAIL PROTECTED]> wrote: > I wish to draw a graph representing multiple series (sets of x,y > points). Each series has its own label and points within each series > are joined by a line ordered by their X cooridnate. > > I would also like a legend au

Re: [R] using the stepfun to plot histogram outline.

2008-06-21 Thread hadley wickham
On Sat, Jun 21, 2008 at 3:36 AM, Karin Lagesen <[EMAIL PROTECTED]> wrote: > > Hello list:) > > I have lots of values which I would like to get a histogram outline > out of. > > An example of what I am talking about: > > testdata = runif(100) > bbb = seq(0,1, by = 0.01) > hist(testdata, breaks = bbb

Re: [R] Suppressing output (e.g. from cat)

2008-06-24 Thread hadley wickham
On Tue, Jun 24, 2008 at 1:15 PM, Prof Brian Ripley <[EMAIL PROTECTED]> wrote: > On Tue, 24 Jun 2008, Richard Pearson wrote: > >> Wacek, many thanks! I'm wondering however whether this will be problematic >> on Windows (I have no windows box to hand to check this, but am creating a >> package that I

Re: [R] Suppressing output (e.g. from cat)

2008-06-24 Thread hadley wickham
>> Or: >> >> tc <- textConnection(NULL, "w") >> sink(tc) >> ... >> sink() >> close(tc) > > That is a lot more expensive and subject to > >o Use of textConnection(NULL, mode="w") could segfault. > > (NEWS for 2.7.1). Output textConnections are convenient, but have quite a > lot of overhead si

Re: [R] two y-axis using ggplot

2008-06-30 Thread hadley wickham
On Tue, Jun 24, 2008 at 3:32 AM, Thorsten Vogel <[EMAIL PROTECTED]> wrote: > Dear List Members > > As a relatively new R user I am extremely glad for there being a nice tool > such as ggplot for producing easily nice graphs in R. Now I want to produce > graphs with two y-axis. I know that this has

Re: [R] ggplot2 legend for vertical lines

2008-07-03 Thread hadley wickham
Hi Baptiste, I've fixed this problem in the development version and you can work around it in the cran version as follows: ggplot(dfr, aes(fact2, values)) + geom_point(aes(colour = fact)) + geom_vline(intercept = 5) (i.e. make sure the vline never sees that colour has been mapped to an aesthetic

Re: [R] ggplot2: scaling and tick mark of x-axis

2008-07-03 Thread hadley wickham
Hi Henning, > It works, however i am not satisfied with the output. I would like to have > the x-axis starting at "2006-08-01" and ending at "2007-08-31" with tick > marks and labels and each 1st of the months. Unfortunately this is a deficiency in the date scale - there's no way to manually set

Re: [R] "lwd" gives different plotted line widths for Vertical and horizontal Lines when lwd= 2?

2008-07-06 Thread hadley wickham
On Sun, Jul 6, 2008 at 6:33 AM, Pedro de Barros <[EMAIL PROTECTED]> wrote: > Dear All, > > I have been trying to add lines to the axis grobs of plots produced with > ggplot2. > > The code I have used is below. It works, although I do not think it is a > really elegant way of doing what I want >

Re: [R] Repeated measures lme or anova

2008-07-06 Thread hadley wickham
On Sun, Jul 6, 2008 at 7:46 AM, Martin Henry H. Stevens <[EMAIL PROTECTED]> wrote: > Hi John, > 1. I do not know why you remove the intercept in the lme model, but keep it > in the aov model. > 2. The distributional assumptions are shot --- you can't run any sort of > normal model with these data.

Re: [R] What is my replication unit? Lmer for binary longitudinal data with blocks and two treaments.

2008-07-06 Thread hadley wickham
Hi Humberto, Instead of starting with a complicated model, how about producing some graphics to aid your understand of the problem? For this example, I'd think it would be revealing to look at the proportion of positive track plates that were positive. If tracks was a variable that summed up the

Re: [R] Method for checking automatically which distribtions fits a data

2008-07-07 Thread hadley wickham
>> Suppose I have a vector of data. >> Is there a method in R to help us automatically >> suggest which distributions fits to that data >> (e.g. normal, gamma, multinomial etc) ? >> >> - Gundala Viswanath >> Jakarta - Indonesia >> > > See > > https://stat.ethz.ch/pipermail/r-help/2008-June/166259.h

[R] Drawing a colour wheel - bug in hcl?

2008-07-07 Thread hadley wickham
Hi All, I'm trying trying to draw a colour wheel (a slice of hcl space) in R. Running the code below doesn't give me what I expect - there's some oddly bright colours of the wrong hue around c(0, 0) and I see three coloured circles (a small magenta, a medium sized yellow and a large cyan). Am I d

Re: [R] "lwd" gives different plotted line widths for Vertical and horizontal Lines when lwd= 2?

2008-07-07 Thread hadley wickham
Hi Pedro, Hmm, that's probably a bug in the way that ggplot2 is drawing the lines. The good news is that the next version of ggplot has a much more flexible theming system, so to get the same effect as your grid code, all you'll need to do is: theme_set(axis.line = theme_segment(colour = "black"

Re: [R] Running "all possible subsets" of a GLM (binomial) model

2008-07-07 Thread hadley wickham
On Mon, Jul 7, 2008 at 10:18 AM, Eric Vander Wal <[EMAIL PROTECTED]> wrote: > I have spent a fair amount of time looking for a package that is automated > to run glm (binomial) regression models with all possible subsets of my > independent variables. Something akin to Lumley's "leaps" package, bu

Re: [R] Drawing a colour wheel - bug in hcl?

2008-07-07 Thread hadley wickham
On Mon, Jul 7, 2008 at 1:05 PM, Earl F. Glynn <[EMAIL PROTECTED]> wrote: > "hadley wickham" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> there's some >> oddly bright colours of the wrong hue around c(0, 0) and I see three >>

Re: [R] Colour clusters in a 2d plot

2008-07-07 Thread hadley wickham
On Mon, Jul 7, 2008 at 12:51 PM, Josep Maria Campanera Alsina <[EMAIL PROTECTED]> wrote: > R experts, > > I have three columns. c1 and c2 are numeric variables whereas c3 are the > clusters classes (nominal variable, 10 different: cluster1, cluster2, > cluster3, cluster4, cluster5 ). I'd like t

Re: [R] Drawing a colour wheel - bug in hcl?

2008-07-07 Thread hadley wickham
On Mon, Jul 7, 2008 at 4:30 PM, Earl F. Glynn <[EMAIL PROTECTED]> wrote: > "hadley wickham" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> On Mon, Jul 7, 2008 at 1:05 PM, Earl F. Glynn <[EMAIL PROTECTED]> >> wrote: >>>

Re: [R] Drawing a colour wheel - bug in hcl?

2008-07-07 Thread hadley wickham
> If you replace this by > hcl$colour <- hcl(hcl$h, hcl$c, hcl$l, fixup = FALSE) > >> with(hcl, plot(x, y, col=colour, pch=20)) > > Then, the resulting "wheel" has three overlapping "holes" corresponding to > the colors previously fixed. Oops, thanks for pointing that out. > Also, as hue/chroma

Re: [R] Histogram with colors according to factor

2008-07-08 Thread hadley wickham
> Given a data frame with a continuous variable and a factor. I would like to > generate a histogram of the continuous variable, where each bar is filled > with different colors according to the percentage of factor values falling > into this region of the continuous variable. How exactly do you w

Re: [R] Port package

2008-07-09 Thread hadley wickham
On Wed, Jul 9, 2008 at 3:09 PM, Ben Bolker <[EMAIL PROTECTED]> wrote: > Katharine Mullen few.vu.nl> writes: > >> >> It is not an R package, but rather a collection of Fortran functions >> that R uses from netlib: >> http://www.netlib.org/port/ >> > > Where is Martin Maechler when we need him? > "

Re: [R] Grid building in R

2008-07-09 Thread hadley wickham
What do you mean by equidistant? You can have three points that are equidistant on the plane, but there's no way to add another point and have it be the same distance from all of the existing points. (Unless all the points are in the same place) Hadley On Wed, Jul 9, 2008 at 5:02 PM, hippie dre

Re: [R] Operator overloading

2008-07-10 Thread hadley wickham
On Thu, Jul 10, 2008 at 5:09 AM, Peter Dalgaard <[EMAIL PROTECTED]> wrote: > Tine wrote: >> Hi! >> >> I was just wondering is there anyway to overload operator for custom >> class. >> For example: >> I have two matrices A and B with same dimensions. I want to overload >> operator '+' with my own fu

Re: [R] Non-normal data issues in PhD software engineering experiment

2008-07-10 Thread hadley wickham
On Thu, Jul 10, 2008 at 11:06 AM, Daniel Malter <[EMAIL PROTECTED]> wrote: > > I hope you don't really want our patients :) > > It looks that you have an experiment with two groups. You have several > trials for each group. And within each trial you observe your units a > distinct points in time. >

Re: [R] layout is to xyplot as ??? is to qplot

2008-07-10 Thread hadley wickham
On Thu, Jul 10, 2008 at 3:28 PM, Jim Price <[EMAIL PROTECTED]> wrote: > > Playing with ggplot, something I'd promised myself I'd get around to. I've > the following scenario: > > library(lattice) > library(ggplot2) > > myData <- data.frame( >x = rnorm(100), >y = rnorm(100), >

Re: [R] data summerization etc...

2008-07-12 Thread hadley wickham
On Sat, Jul 12, 2008 at 7:44 AM, sj <[EMAIL PROTECTED]> wrote: > Hello, > > I am trying to do some fairly straightforward data summarization, i.e., the > kind you would do with a pivot table in excel or by using SQL queires. I > have a moderately sized data set of ~70,000 records and I am trying to

Re: [R] enscript states file for R scripts?

2008-07-15 Thread hadley wickham
An alternative to enscript is highlight, http://www.andre-simon.de/doku/highlight/en/highlight.html, which does come with R highlighting built in. Hadley On Tue, Jul 15, 2008 at 2:57 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi group! > > GNU enscript is a free (as in freedom) text file

Re: [R] Melt (reshape) question

2008-07-15 Thread hadley wickham
> Am > I right in thinking that this *should* also remove the -99s (NA > values)? Because at present, the lower end ot the file looks like this: Judging from your output, the -99's haven't been converted to NA's - you can fix this (and the 88s) by doing: PopDens[PopDens == -99] <- NA PopDens[PopD

Re: [R] How to plot the dendrogram or tree for kmeans ?

2008-03-20 Thread hadley wickham
On Thu, Mar 20, 2008 at 5:45 AM, <[EMAIL PROTECTED]> wrote: > Why do you think there is one? kmeans is an agglomerative clustering > algorithm, not a recursively dividing one. > > Since there is no clustering hierarchy, so there is no dendrogram. However, you could create a "clustergram": @ar

Re: [R] ggplot - axis labels angle

2008-03-21 Thread hadley wickham
Hi Bernd, Something like: qplot(mpg, wt, data=mtcars) grid.gedit("xaxis::label::text", rot=45) should do the trick. The only problem is that the automatic sizing is set up to work with one orientation of labels. You might be able to fudge a solution by experimenting with hjust and vjust, and x

Re: [R] ggplot2 - facetting

2008-03-25 Thread hadley wickham
On Tue, Mar 25, 2008 at 9:49 AM, Pedro de Barros <[EMAIL PROTECTED]> wrote: > Dear All, > > After having overcome the issue of legends (thanks, Thierry, once > more), I am trying to use facetting, but here also I can not find how > to do this. I do not want to use qplot, but rather the more flex

Re: [R] Combining several mappings in ggplot2

2008-03-25 Thread hadley wickham
On Tue, Mar 25, 2008 at 11:48 AM, Tribo Laboy <[EMAIL PROTECTED]> wrote: > Hello, > > I want to be able to make a plot that has several series with > different color and linetype. > Online documentation suggest that this is possible, but I haven't found how: > > "We can also create redundant ma

Re: [R] Different axis limits for each facet in ggplot2

2008-03-25 Thread hadley wickham
On Tue, Mar 25, 2008 at 3:06 PM, Law, Jason <[EMAIL PROTECTED]> wrote: > Does Hadley's response to the following post still hold for the most recent > version of ggplot2? > > http://tolstoy.newcastle.edu.au/R/e2/help/07/07/21347.html#21379qlink2 Yes, it does. It's still on my todo list, but I'm

[R] Thinking about using two y-scales on your plot?

2008-03-25 Thread hadley wickham
Please read this first: http://www.perceptualedge.com/articles/visual_business_intelligence/dual-scaled_axes.pdf It's a reasoned discussion of why it's a bad idea and proposes some alternative methods. Another good article is: K. W. Haemer. Double scales are dangerous. The American Statistician,

Re: [R] ggplot2 argument handling odd

2008-03-26 Thread hadley wickham
On Wed, Mar 26, 2008 at 11:03 AM, Sebastian Weber <[EMAIL PROTECTED]> wrote: > Hello there, > > I'm trying to do lots of plots in one for-loop. But somehow ggplot does > not evaluate arguments as expected. Here is an example: > > library(lattice) > library(ggplot2) > pl <- list() > pl2 <- lis

Re: [R] Combining several mappings in ggplot2

2008-03-26 Thread hadley wickham
On Wed, Mar 26, 2008 at 6:01 AM, Tribo Laboy <[EMAIL PROTECTED]> wrote: > Apologies! I though that the Orange dataset comes with R, but it is in > fact in the package "datasets". > > So here's another "Orange2" dataset for the example: > > Tree_v = rep(c(1:5),each = 5) > age_v = rep(seq(1,25, b

Re: [R] ggplot2 argument handling odd

2008-03-27 Thread hadley wickham
> Ok, I will try that, thanks. BTW, where is this aes_string option > documented, sounds useful? How could I do the same thing with facetting? > If I want to save something like ". ~ groupVar" as a string in a > variable, could I pass it with facet_string to ggplot? It's a see also from ?aes (

Re: [R] Rule for accessing attributes?

2008-03-27 Thread hadley wickham
> xydf <- data.frame(x = 1:5, y = 11:15) > plt <- ggplot(data = xydf, aes(x = x,y = y)) + geom_point() > attributes(plt) > > Now we can change the title: > > plt$title <- "My Title" > plt This is rather poorly documented, but the preferred way of setting the title is now: p + opts(title = "

Re: [R] barplot as Trellis graphic

2008-03-28 Thread hadley wickham
On Fri, Mar 28, 2008 at 1:42 AM, Agustin Lobo <[EMAIL PROTECTED]> wrote: > Thanks for your detailed explanation. > You are right, a set of boxplots done with bwplot > is a much better graphic for this type of data: > > bwplot(V1~VAR|f,data=datos2) > > This was not a good example. The barplot wo

Re: [R] Converting a data frame to matrix

2008-03-28 Thread hadley wickham
> > Is there any other way I can do this. > > > > say row names are city schools > > colnames are student names > > > Hi Adrian, > Have you looked at color2d.matplot in the plotrix package? > > Jim You might also want to check out the seriation package, which provides tools to reorder you

Re: [R] Quick question: Does this graph have a name?

2008-03-28 Thread hadley wickham
> I think it looks like a spineplot. Which is a special case of a mosiac plot with only two variables. Hadley PS. I suspect that the plot could be improved by ordering the x and y variables by their marginal counts. (Although maybe the y axis already has an ordering?) -- http://had.co.nz/

Re: [R] ggplot2 - legend for fill coulours

2008-04-01 Thread hadley wickham
> However, it looks this works only when the data are in the sequence > of the levels in the factor defining the fill colours. When the > sequence is different, the legend gets "scrambled", in that the order > of the colours does not match the labels. You can fix this by explicitly specifying

Re: [R] Thinking about using two y-scales on your plot?

2008-04-02 Thread hadley wickham
> I've got a series of graphs I generate in R to illustrate backup > activity. These are scaled, primarily, in bytes. But different > activities have different costs per byte, and I augment the bytes > scale with dollars. > > http://docs.osg.ufl.edu/tsm/current/ext/UFEXCH-MBX01.AD.UFL.EDU-al

[R] [R-pkgs] ggplot2 - version 0.6

2008-04-03 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] NA vs.

2008-04-04 Thread hadley wickham
On Fri, Apr 4, 2008 at 11:00 AM, Muenchen, Robert A (Bob) <[EMAIL PROTECTED]> wrote: > Dear R-Helpers, > > Why does R show character missing values in vectors as NA and when > stored in a data frame as ? I've searched but did not find an > explanation. It's because that character vector is auto

Re: [R] How to access the attributes of a ggplot?

2008-04-07 Thread hadley wickham
Hi Tribo, > I found 'ggopts', but it only returns some of the properties. Say I > want to get the x- and y-axis limits, the tickmark locations, legend > current position, the legend box and background color and set them to > new values. > > Are these properties easily accessible (and modifia

Re: [R] ggplot: Axis lines

2008-04-07 Thread hadley wickham
Hi Pedro, > I am trying to print some simple ggplot plots, but I would like to > have no gridlines, and no border. > I have achieved this using ggopt(grid.lines='NA', border.lines='NA'). > > However, this also clears the axis lines, and reading the help, it > looks like the "axis" objects hav

Re: [R] How to access the attributes of a ggplot?

2008-04-08 Thread hadley wickham
> Thanks for replying. I know that I can directly modify some of the > properties of the plot object, but I was more interested in querying > the current plot properties, something like: > > xlimits <- getggopts(pobj, "x_scale_limits") > > Is there anything like this implemented? Ah, that's m

Re: [R] Practical Data Limitations with R

2008-04-08 Thread hadley wickham
> We are new to R and evaluating if we can use it for a project we need to > do. We have read that R is not well suited to handle very large data > sets. Assuming we have the data prepped and stored in an RDBMS (Oracle, > Teradata, SQL Server), what can R reasonably handle from a volume > per

Re: [R] Changing default plot behaviour

2008-04-09 Thread hadley wickham
On Wed, Apr 9, 2008 at 10:12 AM, Thompson, David (MNR) <[EMAIL PROTECTED]> wrote: > Hello, > > How would I make the default behaviour of my plots produce output such > as the following (i.e. tick marks inside on all axes, labels only on two > (arbitrary?) sides) without needing the five addition

Re: [R] two graphs in one figure?

2008-04-10 Thread hadley wickham
On Thu, Apr 10, 2008 at 8:36 AM, ONKELINX, Thierry <[EMAIL PROTECTED]> wrote: > Dear Anne-Katrin, > > You could use ggplot to do this. The example below works, although it > generates some warnings. > > library(ggplot2) > dataset <- data.frame(x = 0:55, y = rnorm(56, 10), z = runif(56, 9, 11))

Re: [R] Vegan plotting- color help

2008-04-11 Thread hadley wickham
> ## dummy group ID > group <- sample(rep(1:3, each = 4)) > ## create dummy grouping factor > group <- factor(group, labels = paste("group", 1:3)) > group > > # vector of colours > cols <- c("red", "blue", "green") > ## dummay data to plot > datx <- runif(12) > daty <- runif(12) > > ## p

Re: [R] Predict Function

2008-04-12 Thread hadley wickham
On Sat, Apr 12, 2008 at 1:06 PM, Biago <[EMAIL PROTECTED]> wrote: > > Hi all - my first time here and am having an issue with the Predict function. > > I am using a tutorial as a guide, locate here: > http://www.ats.ucla.edu/STAT/R/dae/mlogit.htm > > My code gives this error > > > newdata1$pre

Re: [R] ggplot2 - plot with only legend?

2008-04-17 Thread hadley wickham
Hi Pedro, There's no particularly easy way to do this. However, you can create the scales, train them manually, and then draw them in any way you choose: colour <- scale_colour_hue("My scale") colour$train(factor(c("a","b"))) grid.newpage() grid.draw(gglegend(colour$legend_desc(), list(colour="p

Re: [R] vector in filename

2008-04-18 Thread hadley wickham
On Thu, Apr 17, 2008 at 8:05 PM, [Ricardo Rodriguez] Your XEN ICT Team <[EMAIL PROTECTED]> wrote: > Hi, > > I am trying to generate a group of graphics with an iteration. Some > thing like this... > > x=1 > y=1 > max=10 > myfiles <- paste("foo", x:max, ".png", sep="") > while (x =< max) >

[R] Embedding fonts in pdfs

2008-04-18 Thread hadley wickham
Hi all, I'm having problems embedding fonts in my graphics - and I've tried embedFonts to no avail. I have a pdf file and pdffonts tells me: name type emb sub uni object ID - --- --- --- - Z

Re: [R] superposing a group of x,y-plot points

2008-04-19 Thread hadley wickham
On Sat, Apr 19, 2008 at 1:06 PM, Tobias Verbeke <[EMAIL PROTECTED]> wrote: > Anna-Maria Tyrisevä wrote: > > > please, could somebody tell me how can I superpose a group of x,y-plot > > points (using different symbols) that belong to a certain class of factor > z? > > Can't find a solution despi

Re: [R] Multidimensional contingency tables

2008-04-22 Thread hadley wickham
On Mon, Apr 21, 2008 at 9:46 PM, Robert A. LaBudde <[EMAIL PROTECTED]> wrote: > How does one ideally handle and display multidimenstional contingency > tables in R v. 2.6.2? > > E.g.: > > > prob1<- data.frame(victim=c(rep('white',4),rep('black',4)), > + perp=c(rep('white',2),rep('black',2),r

Re: [R] Research Notes

2008-04-22 Thread hadley wickham
> I wouldn't dream of using a proprietary tool with a proprietary and > closed format for this kind of thing EVER. If you want something more > sophisticated than my Plain Text File solution then keep a 'NOTES.tex' > file then you can include equations and graphics. Plus it's then trivial > t

Re: [R] Multidimensional contingency tables

2008-04-22 Thread hadley wickham
On Tue, Apr 22, 2008 at 8:24 AM, hadley wickham <[EMAIL PROTECTED]> wrote: > On Mon, Apr 21, 2008 at 9:46 PM, Robert A. LaBudde <[EMAIL PROTECTED]> wrote: > > How does one ideally handle and display multidimenstional contingency > > tables in R v. 2.6.2? > >

Re: [R] Getting rid of borders on semi-transparent plotting symbols

2008-04-22 Thread hadley wickham
But is this behaviour a bug or by design? Hadley On Tue, Apr 22, 2008 at 10:47 AM, Prof Brian Ripley <[EMAIL PROTECTED]> wrote: > plot(0, 0, pch=21, bg="#FF22", col="#FF01") > > may be (close to) what you are looking for. > > > > On Tue, 22 Apr 2008, Karl Ove Hufthammer wrote: > > > R v

Re: [R] Using the 'by' function within a 'for' loop

2008-04-22 Thread hadley wickham
Hi Judith, Could you provide a copy of your data as well? (Either as a csv file, or by copying and pasting the output of dput(my.data.frame) or by generating a data.frame of random numbers with the same structure as your data). That will help people to see what your code does and suggest improve

Re: [R] Choice of notch size in R

2008-04-22 Thread hadley wickham
On Tue, Apr 22, 2008 at 2:00 PM, Alex Reynolds <[EMAIL PROTECTED]> wrote: > Many thanks to you and Peter Dalgaard for your advice. Instead of > notches on a classic box plot, I have elected to draw a more > "minimalized" box plot along the lines suggested by Tufte, and overlap a > custom signifi

Re: [R] g(x,y) = f(x,y) - e(x)- e(y)?

2008-04-23 Thread hadley wickham
> Thanks Phipp very much for your help. I had meant, given that I'd > computed the matrix f[x,y] and the vector e[x], how to take the > difference. What is confusing is how to subtract a vector from a > matrix. I don't want the recycling rule. That function sounds like its describing how to sub

Re: [R] Can I get rid of this for loop using apply?

2008-04-23 Thread hadley wickham
On Wed, Apr 23, 2008 at 4:23 PM, Mike Dugas <[EMAIL PROTECTED]> wrote: > The answer to my post is yes (which I just figured out). > Switching from for to apply isn't going to speed up your code. If you carefully read the source code of apply, you'll see the guts of the work is done by: for (i i

Re: [R] Can I get rid of this for loop using apply?

2008-04-23 Thread hadley wickham
On Wed, Apr 23, 2008 at 7:31 PM, Mike Dugas <[EMAIL PROTECTED]> wrote: > Thanks for the help. That explains why my time testing showed no > difference. Is there any way to speed up the program? It is unbearably > slow if I increase the number of loops. Could you explain exactly what you're tryi

Re: [R] Can I get rid of this for loop using apply?

2008-04-24 Thread hadley wickham
> Great suggestions. I tested the code on an example and the run time was > reduced from 1 min 12 sec to 3 sec. Also, I like the suggestion to look at > the quantiles. I will see what insight it provides in terms of detecting > masked interactions. Well that's a decent speed up :) > I have a c

Re: [R] Documentation General Comments

2008-04-24 Thread hadley wickham
> Help files with alias or concept or title matching 'data type' using > fuzzy matching: > character-class(methods) > Classes Corresponding to Basic Data Types > sqlTypeInfo(RODBC) Request Information about DataTypes in an ODBC > Database >

Re: [R] Bug? in summary( ) function base package

2008-04-30 Thread hadley wickham
On Wed, Apr 30, 2008 at 1:06 PM, Richard Saba <[EMAIL PROTECTED]> wrote: > There seems to be an error in the summary() function when applied to "ts" > class objects. The results of a call to summary( ), on the R "ts" data set > USAccDeaths , reports the wrong value for Max. The value reported by

Re: [R] points size in plots

2008-05-02 Thread hadley wickham
Hi Irene, Assuming you have already calculated the standard errors, something like the following will work: library(ggplot2) qplot(x, y, data=mydataframe, size = se) Hadley On Fri, May 2, 2008 at 8:52 AM, Irene Mantzouni <[EMAIL PROTECTED]> wrote: > Dear list, > > > > I would like to produce a

Re: [R] Transform values from one column into column names of new dataframe

2008-05-02 Thread hadley wickham
On Fri, May 2, 2008 at 11:05 AM, Matt <[EMAIL PROTECTED]> wrote: > Hi, I have a question about reformatting data. It looks like it should > be simple, but I've been working at it for awhile now and it's about > time I ask for help. > > My data look like this: > > ITEM VALUE STEP > item1 A

Re: [R] Extract lags from a formula

2008-05-02 Thread hadley wickham
On Fri, May 2, 2008 at 1:35 PM, Kerpel, John <[EMAIL PROTECTED]> wrote: > Hi folks! > > > > How do I extract lags from a formula? An example: > > > > mod.eq<-formula(x~lag(x,-1)+lag(x,-2)) > > > mod.eq > > x ~ lag(x, -1) + lag(x, -2) > > > mod.eq[1] > > "~"() > > > mod.eq[2] > > x() > > >

[R] [R-pkgs] New package: profr 0.1 - an alternative display for profiling information

2008-05-02 Thread hadley wickham
profr 0.1 profr provides an alternative data structure and display for profiling data. It still uses Rprof() to collect the data, but outputs a data.frame which should be easier to manipulate. It also implements a novel visualisation which allows you to see the lengt

Re: [R] improvement of Ancova analysis

2008-05-04 Thread hadley wickham
On Sat, May 3, 2008 at 9:00 PM, Tobias Erik Reiners <[EMAIL PROTECTED]> wrote: > Dear Helpers, > > I just started working with R and I'm a bit overloaded with information. > > My data is from marsupials reindroduced in a area. I have weight(wt), hind > foot > lenghts(pes) as continues variables

Re: [R] plotting pie-charts into a coordinate system

2008-05-04 Thread hadley wickham
On Sun, May 4, 2008 at 2:30 PM, Georg Ehret <[EMAIL PROTECTED]> wrote: > Dear R user group, > I wish to plot small pie-charts to specific coordinates in a e.g. > scatter-plot: > > E.g.: > > plot(rnorm(100),rnorm(100)) > > points(1,1,col="red",cex=4) > -> I wish to put pie(c(2,3)) at the p

Re: [R] Column renaming

2008-05-05 Thread hadley wickham
On Mon, May 5, 2008 at 12:08 PM, hadley wickham <[EMAIL PROTECTED]> wrote: > On Mon, May 5, 2008 at 10:54 AM, Chip Barnaby <[EMAIL PROTECTED]> wrote: > > Yes, someone else pointed out my typo, sorry. > > > > My issue here is that referring to columns by index i

Re: [R] Column renaming

2008-05-05 Thread hadley wickham
On Mon, May 5, 2008 at 10:54 AM, Chip Barnaby <[EMAIL PROTECTED]> wrote: > Yes, someone else pointed out my typo, sorry. > > My issue here is that referring to columns by index is risky. Hard-coded > indices will be buried in code and there will be trouble if (when) the data > organization change

Re: [R] computational ontology to research questions, and statistical methods

2008-05-05 Thread hadley wickham
> Question for the list members: Is anybody aware of any existing > ontologies computational focusing on this topic? Have you look at zelig (http://gking.harvard.edu/zelig/) ? It unifies a lot of statistical models within a framework that describes variable types for input and output. You mig

Re: [R] Is there in R a function equivalent to the mround, as found in most spreadsheets?

2008-05-06 Thread hadley wickham
> > I believe this function matches the description in OOO: > > mround <- function(number, multiple) multiple * round(number/multiple) I've implemented a slightly more general form in the reshape package: round_any <- function (x, accuracy, f = round) { f(x/accuracy) * accuracy } Hadley -

Re: [R] Not to draw the xaxis ticks in ggplot2

2008-05-07 Thread hadley wickham
On Tue, May 6, 2008 at 11:44 PM, ronggui <[EMAIL PROTECTED]> wrote: > >library(ggplot2) > >(p<- qplot(mpg, wt, data=mtcars)) > What I am doing is to set color of the ticks to hide them. > >grid.gedit(gPath("xaxis", "ticks"), gp=gpar(col="white")) > > It should be a better way to achieve the pur

Re: [R] ggplo2: x_discrete labels size/direction

2008-05-07 Thread hadley wickham
> PS Perhaps it'd still be really useful to be able to change text direction > in labels. > Hadley, what do you think? Agreed. I've added it to my ggplot2 customisation to do list. Thanks, Hadley -- http://had.co.nz/ __ R-help@r-project.org mai

Re: [R] Create pairwise table from columns?

2008-05-10 Thread hadley wickham
On Fri, May 9, 2008 at 7:17 PM, knussear <[EMAIL PROTECTED]> wrote: > > Hi Group > > I have a large data set of individual pairwise values (250,000 rows) that I > need to reshape into a pairwise matrix for mantel tests of these values > versus genetic distances. > > the data are currently in column

Re: [R] ggplot2: font size mismatch for pdf output

2008-05-12 Thread hadley wickham
> More generally, how do I control the size of fonts used in legends > and axis labels? There is no general way (yet) - it is on my customisation to do list, which I hope to make progress on over summer. Hadley -- http://had.co.nz/ __ R-help@r-projec

Re: [R] ggplot2: font size mismatch for pdf output

2008-05-13 Thread hadley wickham
> There is a bug in ggsave() for bitmap devices: it computes the width and > height from 'dpi', but it fails to pass that information on to the devices, > which assume 72dpi. So what it actually asked for was a > 8 x 6.67 inch plot at 72dpi. 72dpi would be a better default, as not all > of the

Re: [R] Converting qqplot2 qplot() to grammar?

2008-05-13 Thread hadley wickham
On Mon, May 12, 2008 at 3:31 PM, B. Bogart <[EMAIL PROTECTED]> wrote: > Hello all, > > I've been using the following qplot command: > > qplot(pixX,pixY, data=som, geom="tile", fill=rgb) + > scale_fill_identity() + opts(aspect.ratio = .75) + facet_grid(unitX ~ unitY) > > Now I would like to conv

Re: [R] How to change col and pch between panels in xyplot

2008-05-17 Thread hadley wickham
On Sat, May 17, 2008 at 10:03 PM, Michael Kubovy <[EMAIL PROTECTED]> wrote: > Dear R-helpers, > > x <- rep(1:2, 4) > y <- c(2, 4, 3, 5, 1, 3, 2, 4) > w <- factor(rep(1:2, each = 4)) > v <- rep(1:2, each = 2, 2) > xyplot(y ~ x | w, groups = v, type = 'b') > > How do I tell xyplot to use four colors

Re: [R] R 2.70 + ps2pdf14

2008-05-18 Thread hadley wickham
> if developers from the R graphics group are reading this, given that > this strange output is not just my imagination, maybe it would be > worthwhile to see if the R output pdf could be made more robust to > avoid this "feature." I stumbled onto it deep in a program, and spend > an afternoon dis

Re: [R] reshape a wide data frame from wide to a long format with metadata columns

2008-05-19 Thread hadley wickham
Hi Alan, > I have a general question about reshaping a wide data frame using the > "reshape" command. I have a data frame consisting of 108 columns that > I would like to convert to a long table and remove the metadata > (embedded in the column names of the wide table) to new metadata > columns in

Re: [R] Histograms without bars

2008-05-19 Thread hadley wickham
> Is is possible to plot points whose y coordinate correspond to that > probability, instead of plotting the histogram bars? In other words, > instead of having a bar of width 0.01 and height, say, 80, I'd like to > have a single point at y = 0.8. Very easily with ggplot2: install.packages("ggplo

Re: [R] Question about banking to 45 degrees.

2008-05-20 Thread hadley wickham
> I've also come across "banking ()", but I don't understand it, nor the > significance of the value it returns. Regardless, it doesn't seem to be the > aspect ratio that I am looking for. You might also want to have a look at: @article{heer:2006, Title = {Multi-scale banking to 45 de

Re: [R] Converting qqplot2 qplot() to grammar?

2008-05-21 Thread hadley wickham
> Now that this part is working there are two more aspects of the plot I > would like to remove: (in order of importance) > > * The row/column facetting labels. You should be able to find that using grid.ls() > * the whitespace that surrounds the plot. I'd like the ggsave output to > resemble the

Re: [R] ggplot2 frequency Y axis label

2007-11-16 Thread hadley wickham
Hi Felipe, That's should be the default. How is it different to what you expect? Hadley On 11/16/07, Felipe Carrillo <[EMAIL PROTECTED]> wrote: > Hi all: > I wonder if ggplot2 can create histograms with > frequency along the Y axis > > Felipe D. Carrillo > Fishery Biologist > US Fish & Wil

Re: [R] Exponential Smoothing for ggplot2's stat_smooth()

2007-11-16 Thread hadley wickham
Hi Michael, To use stat_smooth as is, you need a smoothing function that basically works like lm. So you have two options: to make an interface to HoltWinters (or find another exponential smooth that already has that interface) or write your own stat object, which might look something like this:

Re: [R] Help Required in using cast (reshape package) function

2007-11-21 Thread hadley wickham
On 11/21/07, Punit Anand <[EMAIL PROTECTED]> wrote: > Hello everyone, > > Since the fields in variables column are unique with respect to ID and > fiscal year; any function like > sum,min,max,mean etc will lead to the desired result You should probably check that, as the warning only occurs when a

Re: [R] ggplot2 axis labels

2007-11-21 Thread hadley wickham
That should still work? If it doesn't, you should be able to figure out what the new element name is by following the recipe in the last chapter of the ggplot book. Hadley On 11/21/07, Felipe Carrillo <[EMAIL PROTECTED]> wrote: > Hi: > Does anyone(Hadley?)know how to change the axis labels > with

Re: [R] more outrageous plotting

2007-11-22 Thread hadley wickham
Hi Juan, Assuming that your data frame is named df, something like the following should work: library(ggplot) qplot(X, Y, data = df, colour = Z, label = Z, geom = "text") + scale_colour_continuous(low="orange", high = "blue") You can find out more about ggplot2 at http://had.co.nz/ggplot2. Had

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

2007-11-23 Thread hadley wickham
> 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 > think it would help. Any volunteers? There are two common types of review. When review

Re: [R] multiple comparisons/tukey kramer

2007-11-23 Thread hadley wickham
> However, I don't know what exactly glht does, and the help file is > extremely terse. It offers the following options (in contrMat()): > > contrMat(n, type=c("Dunnett", "Tukey", "Sequen", "AVE", > "Changepoint", "Williams", "Marcus", > "McDermo

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