Re: [R] The end of Matlab

2008-12-12 Thread hadley wickham
On Fri, Dec 12, 2008 at 11:18 AM, Duncan Murdoch murd...@stats.uwo.ca wrote: On 12/12/2008 11:38 AM, hadley wickham wrote: On Fri, Dec 12, 2008 at 8:41 AM, Duncan Murdoch murd...@stats.uwo.ca wrote: On 12/12/2008 8:25 AM, hadley wickham wrote: From which you might conclude that I don't

Re: [R] The end of Matlab

2008-12-12 Thread hadley wickham
On Fri, Dec 12, 2008 at 11:11 AM, Vitalie Spinu vitosm...@rambler.ru wrote: On Fri, 12 Dec 2008 17:38:13 +0100, hadley wickham h.wick...@gmail.com wrote: You could also imagine similar iterators for random sampling, like samp(0.2) to choose 20% of the indices, or boot(0.8) to choose 80

Re: [R] The end of Matlab

2008-12-12 Thread hadley wickham
Oh yes, that's a good point. But wouldn't the following do the job? .selector - function(a, b) { function(n) a(n) b(n) } or .selector - function(a, b) { function(n) intersect(a(n), b(n)) } depending on whether selectors return logical or numeric vectors. Writing functions for |

Re: [R] The end of Matlab

2008-12-12 Thread hadley wickham
My end would be the output of your end(). If there are no args and no local context, I don't see the need for it to be a function call. It would just be defined as something like end - structure( function(n) c(rep(FALSE, n-1), TRUE), class=selector) Oh, I see what you mean. I'm not sure

Re: [R] The end of Matlab

2008-12-12 Thread hadley wickham
On Fri, Dec 12, 2008 at 3:08 PM, Vitalie Spinu vitosm...@rambler.ru wrote: On Fri, 12 Dec 2008 18:27:02 +0100, hadley wickham h.wick...@gmail.com wrote: or may be just mtcars[cyl3last(20)] or this is already too far? This would be a considerable extension because then the selector would

Re: [R] ref card for data manipulation?

2008-12-11 Thread hadley wickham
You (as many before you) have overlooked the ave() function, which can replace the ordering as well the do.call(c,tapply()) Majority of questions on this list concern data manipulation. Many are repetitive. Overlooking like that will always happen unless some comprehensive data

Re: [R] Polar coordinates - contour plots

2008-12-10 Thread hadley wickham
On Wed, Dec 10, 2008 at 4:33 AM, Todor Kondic [EMAIL PROTECTED] wrote: Thanks Bert for the answer! I'll try to find an appropriate package. In the end, i have fiddling. But, can anyone tell me, were I to create an underlying implementation of cooridnate transforms, perhaps controlled by user

Re: [R] tapply within a data.frame: a simpler alternative?

2008-12-10 Thread hadley wickham
On Wed, Dec 10, 2008 at 11:02 AM, baptiste auguie [EMAIL PROTECTED] wrote: Dear list, I have a data.frame with x, y values and a 3-level factor group, say. I want to create a new column in this data.frame with the values of y scaled to 1 by group. Perhaps the example below describes it best:

Re: [R] read.*: How to read from a URL?

2008-12-10 Thread hadley wickham
Hi Michael, In general, I think you should be able to do: gimage - read.jpeg(url(gimageloc)) or alternatively use the EBImage from bioconductor which will read from a url automatically (it also opens a much wider range of file types) library(EBImage) img - readImage(gimageloc, TrueColor)

Re: [R] how to merge panel data stored by variable?

2008-12-10 Thread hadley wickham
On Wed, Dec 10, 2008 at 1:54 PM, Viktor Nagy [EMAIL PROTECTED] wrote: 2008/12/10 Stefan Grosse [EMAIL PROTECTED] I have two datasets stored in tab-separated format in the following way file1: country year1year2 Germanyvar1 var1 Hungary var1

Re: [R] repeated searching of no-missing values

2008-12-10 Thread hadley wickham
On Wed, Dec 10, 2008 at 4:09 PM, Patrizio Frederic [EMAIL PROTECTED] wrote: hi all, I have a data frame such as: 1 blue 0.3 1 NA0.4 1 red NA 2 blue NA 2 green NA 2 blue NA 3 red 0.5 3 blue NA 3 NA1.1 I wish to find the last non-missing value in every 3ple: ie I want a

Re: [R] repeated searching of no-missing values

2008-12-10 Thread hadley wickham
graphics,statistical analysis etc. as well as programming. There are just too many possible data structures to expect logical consistency in their handling throughout (if one can even define what that means in specific instances!). I disagree with this claim: I think it is possible to create

Re: [R] repeated searching of no-missing values

2008-12-10 Thread hadley wickham
Perhaps... But plyr works only on **basic** data structures, and I referred to all **possible** data strucures (deliberately); so I stand by my statement and note that you did not contradict it. To me the basic structures are vectors, matrices and arrays; lists; and data frames (that these are

Re: [R] Replacing tabs with appropriate number of spaces

2008-12-09 Thread hadley wickham
On Tue, Dec 9, 2008 at 10:39 AM, Dennis Fisher [EMAIL PROTECTED] wrote: Colleagues, Platform: OS X (but issue applies to all platforms) Version: 2.8.0 I have a mixture of text and data that I am outputting via R to a pdf document (using a fixed-width font). The text contains tabs that

Re: [R] == operand

2008-12-09 Thread hadley wickham
On Tue, Dec 9, 2008 at 5:36 PM, Renny Li [EMAIL PROTECTED] wrote: Hi, I am trying to compare two values using == operand, please take a look of the following example (I copied ALL what I did here without deleting any line) bb-1 cc-50 cc==abs(bb+52) [1] FALSE C-53 C-53 c-53

Re: [R] How to force aggregate to exclude NA ?

2008-12-07 Thread hadley wickham
On Sun, Dec 7, 2008 at 10:10 AM, Daren Tan [EMAIL PROTECTED] wrote: How to use the na.rm function outside aggregate ? I tried na.rm - function(f) { function(x, ...) f(x[!is.na(x)], ...) } na.rm(sum(c(NA,1,2))) function(x, ...) f(x[!is.na(x)], ...) na.rm(sum, c(NA,1,2)) Error in

Re: [R] complex(?) reshaping question

2008-12-05 Thread hadley wickham
I'm trying to omit NA:s in this DF and produce a reduced DF. The problem is that I cannot completely omit NA rows. I tried library(reshape) g - melt(DF, id=c(idvar1, idvar2)) g - na.omit(g) You're missing an id variable: DF$idvar3 - 1:2 g - melt(DF, id=c(idvar1, idvar2, idvar3), na.rm =

Re: [R] levels update

2008-12-05 Thread hadley wickham
On Fri, Dec 5, 2008 at 6:50 AM, Antje [EMAIL PROTECTED] wrote: Hello, I hope this question is not too stupid. I would like to know how to update levels after subsetting data from a data.frame. df - data.frame(factor(c(a,a,c,b,b)), c(4,5,6,7,8), c(9,1,2,3,4)) names(df) - c(X1,X2,X3) my.sub

Re: [R] ggplot2 - suggestion for facet_wrap/grid

2008-12-03 Thread hadley wickham
Hi David, facet_wrap and facet_grid function are both very usefull. But they are perhaps a bit redundant. I disagree ;) Conceptually they are rather different: facet_wrap is essentially a 1d layout, while facet_grid is a 2d layout. This has implications for how you specify the faceting, how

Re: [R] ggplot2 facet_wrap problem

2008-12-03 Thread hadley wickham
bericht- Van: stephen sefick [mailto:[EMAIL PROTECTED] Verzonden: woensdag 3 december 2008 1:09 Aan: ONKELINX, Thierry CC: hadley wickham; R-help Onderwerp: Re: [R] ggplot2 facet_wrap problem If you look at the TSS graph in the faceted example and then look at the plot of just the GPP vs

Re: [R] Speeding up casting a dataframe from long to wide format

2008-12-03 Thread hadley wickham
Hi Daren, Unfortunately, the current version of reshape isn't very efficient. I'm working on a new version which should be 10-20x times faster for the operation that you're performing, but this won't be ready for a while and in the meantime you might want to try an alternative approach, like the

[R] Wiley Interdisciplinary Reviews

2008-12-02 Thread hadley wickham
They are obviously growing desperate - I have now been asked to write 5 articles! Hadley -- http://had.co.nz/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] Question to regular expressions

2008-12-02 Thread hadley wickham
On Tue, Dec 2, 2008 at 9:48 AM, Antje [EMAIL PROTECTED] wrote: Hi Gabor, it works! Thank you very much! But I still don't understand the difference between [0-9] and [:digit:]... You might find this site helpful: http://regexp.resource.googlepages.com/analyzer.html Copy in your attempt and

Re: [R] ggplot2 45deg axis labels

2008-12-02 Thread hadley wickham
Hi Stephen, Have a look at the polishing your plot for publication chapter of the ggplot2 book. Regards, Hadley On Tue, Dec 2, 2008 at 5:31 PM, stephen sefick [EMAIL PROTECTED] wrote: I would like to rotate the axis labels 45 deg. -- Stephen Sefick Let's not spend our time and resources

Re: [R] Help with maps

2008-12-02 Thread hadley wickham
On Tue, Dec 2, 2008 at 6:21 PM, Avram Aelony [EMAIL PROTECTED] wrote: A few questions about maps... (1) How can I find a listing of the internal data sets that map() from the maps library contains? For example, usa, county, state, nz all work. Are there any others? help(package = maps)

Re: [R] Bug in transform?

2008-12-02 Thread hadley wickham
The underlying issue is actually not in transform() but in data.frame(): aq - airquality[sample(1:153,6),] data.frame(aq, list(a=1,b=2)) Error in data.frame(aq, list(a = 1, b = 2)) : arguments imply differing number of rows: 6, 1 data.frame(aq, list(a=1)) Ozone Solar.R Wind Temp Month

Re: [R] Non-interactive passing of quoted variables (ggplot, plyr, subset, transform, etc)

2008-12-01 Thread hadley wickham
On Mon, Dec 1, 2008 at 11:06 AM, Vitalie Spinu [EMAIL PROTECTED] wrote: Hello Everyone, May be a silly question. How to pass programmatically variables which are not known in advance and are quoted? Variables are quoted implicitly in functions like subset and transform and explicitly in

Re: [R] How to refer to a list member by variable

2008-12-01 Thread hadley wickham
On Mon, Dec 1, 2008 at 12:53 PM, Reitsma, Rene - COB [EMAIL PROTECTED] wrote: Dear All, I'm hoping one of you can help me with the following R problem. I'm trying to refer to a member of a list by variable. However, this seems not to work: foo=list(first=c(1:10),second=c(11:20)) foo$first

Re: [R] how to input a string without quote

2008-11-30 Thread hadley wickham
On Sun, Nov 30, 2008 at 11:38 AM, Carl Witthoft [EMAIL PROTECTED] wrote: From: Yihui Xie xieyihui_at_gmail.com Date: Sun, 30 Nov 2008 15:32:35 +0800 Wow, you are so lazy... But sometimes R is just designed for lazy guys... Yeah, well, laziness is the mother of creativity :-) . But

Re: [R] controlling the number of times a script is repeated in a loop

2008-11-30 Thread hadley wickham
On Sun, Nov 30, 2008 at 12:21 PM, Salas, Andria Kay [EMAIL PROTECTED] wrote: I am running a large for loop and at the end of each iteration a matrix is produced. The program changes the columns in the matrix, and each time a column is added the name of that column is y. All original columns

Re: [R] R window lines limit

2008-11-28 Thread hadley wickham
On Fri, Nov 28, 2008 at 9:00 AM, Rthoughts [EMAIL PROTECTED] wrote: Hi, Is the number of lines that can be displayed in R GUI limited? When I do a Fourier Tranform of 4000 data points, I can only see the last 300 or so of it. I need to see all of it. How is this possible? Perhaps you could

Re: [R] as.numeric in data.frame, but only where it is possible

2008-11-27 Thread hadley wickham
On Thu, Nov 27, 2008 at 12:53 AM, Kinoko [EMAIL PROTECTED] wrote: Hi, I would like to convert my character sequences in my matrix/ data.frame into numeric where it is possible. I would also like to retain my alphabetic character strings in their original forms. 5.15.1 hm hm

Re: [R] Very slow: using double apply and cor.test to compute correlation p.values for 2 matrices

2008-11-26 Thread hadley wickham
On Wed, Nov 26, 2008 at 8:14 AM, jim holtman [EMAIL PROTECTED] wrote: Your time is being taken up in cor.test because you are calling it 100,000 times. So grin and bear it with the amount of work you are asking it to do. Here I am only calling it 100 time: m1 - matrix(rnorm(1),

Re: [R] Reshape with var as fun.aggregate

2008-11-26 Thread hadley wickham
Hi Jason, The reason you are getting this error is that the latest version of reshape uses fun.aggregate(numeric(0)) to figure out what missing values should be filled in with. Unfortunately there was a brief period in R versions when var(numeric(0)) returned an error rather than a missing

Re: [R] Count days of current year

2008-11-25 Thread hadley wickham
Why not write it yourself? days_in_year - function(year) { 365 + (year %% 4 == 0) - (year %% 100 == 0) + (year %% 400 == 0) } This should work for any year in the Gregorian calendar. Hadley On Mon, Nov 24, 2008 at 1:25 PM, Felipe Carrillo [EMAIL PROTECTED] wrote: Hi: Is there a function

Re: [R] Heat Maps

2008-11-25 Thread hadley wickham
On Tue, Nov 25, 2008 at 9:18 AM, Jacques Wagnor [EMAIL PROTECTED] wrote: Dear List, Does there exist a function that produces a heat map like this one (image 3 of 4):

Re: [R] ggplot2 - facet_grid and facet_wrap

2008-11-24 Thread hadley wickham
=mtcars) + facet_grid(cyl ~ vs) # works qplot(mpg, wt, data=mtcars, geom = line) + facet_grid(cyl ~ vs) Erreur dans grobs[[i, j]] - layer$make_grob(layerd[[i, j]], details, coord) : types (de NULL a list) incompatibles dans l'affectation [[ david 2008/11/23 hadley wickham [EMAIL PROTECTED

Re: [R] ggplot2: positioning legend on top of plot

2008-11-24 Thread hadley wickham
Hi Paul, That's a bug - I'll look into it. Regards, Hadley On Mon, Nov 24, 2008 at 10:46 AM, Paul Emberson [EMAIL PROTECTED] wrote: Hi, With ggplot2 v0.8, how do I position a legend on top of the plot. Things like p + opts(legend.position=top) work ok. But p +

Re: [R] ggplot2 - facet_grid and facet_wrap

2008-11-23 Thread hadley wickham
Hi David, That looks like a bug! I'll look into it. Regards, Hadley On Sat, Nov 22, 2008 at 1:07 PM, David Hajage [EMAIL PROTECTED] wrote: Hello R users (and Hadley) I have another question about ggplot2 :-) (version 0.8) `dat` - structure(list(D = c(a, b, c, d), G =

Re: [R] What's the BEST way in R to adapt this vector?

2008-11-22 Thread hadley wickham
On Sat, Nov 22, 2008 at 12:00 PM, zerfetzen [EMAIL PROTECTED] wrote: Goal: Suppose you have a vector that is a discrete variable with values ranging from 1 to 3, and length of 10. We'll use this as the example: y - c(1,2,3,1,2,3,1,2,3,1) ...and suppose you want your new vector (y.new) to

[R] [R-pkgs] ggplot2 - version 0.8

2008-11-21 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

Re: [R] Calculating SD according to groups of rows

2008-11-20 Thread hadley wickham
(SUBJECT_ID=sample(letters[1:5],100,TRUE),HR=rnorm(100)) sd.list = with(dat, tapply(HR, SUBJECT_ID, sd)) data.frame(SUBJECT_ID=rownames(sd.list),sd=sd.list) I think Hadley Wickham tried to make life easier with the plyr package, so I thought something like the below would work out of the box

Re: [R] Calculating SD according to groups of rows

2008-11-20 Thread hadley wickham
On Thu, Nov 20, 2008 at 10:04 AM, Dieter Menne [EMAIL PROTECTED] wrote: hadley wickham h.wickham at gmail.com writes: library(plyr) dat = data.frame(SUBJECT_ID=sample(letters[1:5],100,TRUE),HR=rnorm(100)) daply(dat,.(SUBJECT_ID),sd) ddply(dat,.(SUBJECT_ID),sd) Well that calculates sd

Re: [R] Problem with ggplot2

2008-11-20 Thread hadley wickham
Hi David, I inadvertently introduced a bug in ggplot in the last release. I uploaded a fix to CRAN this morning and it should be available in the near future. Sorry for the inconvenience. Regards, Hadley On Thu, Nov 20, 2008 at 2:49 PM, David Hajage [EMAIL PROTECTED] wrote: Hello R users,

Re: [R] Identify command in R]

2008-11-20 Thread hadley wickham
Reading in between the lines a little, maybe you want lm(..., na.action = na.exclude) That should return missing values for the influence statistics when the predictor or responses is missing in the input. Hadley On Thu, Nov 20, 2008 at 4:19 PM, David Kaplan [EMAIL PROTECTED] wrote: Let me

Re: [R] Exclude holidays in a subset of dates?

2008-11-19 Thread hadley wickham
On Wed, Nov 19, 2008 at 12:54 PM, Brigid Mooney [EMAIL PROTECTED] wrote: Hi All, I am iterating through dated materials, with variable start and end dates, and would like to skip procedures everytime I encounter a weekend or holiday. To do this, I thought the easiest way would be to create a

Re: [R] ggplot2; dot plot, jitter, and error bars

2008-11-19 Thread hadley wickham
On Wed, Nov 19, 2008 at 5:34 PM, Juliet Hannah [EMAIL PROTECTED] wrote: With this data x - c(0,0,1,1,2,2) y - c(5,6,4,3,2,6) lwr - y-1 upr - y+1 xlab - c(Low,Low,Med,Med,High,High) mydata - data.frame(x,xlab,y,lwr,upr) I would like to make a dot plot and use lwr and upr as error bars.

Re: [R] ggplot2: using more than 6 symbols

2008-11-17 Thread hadley wickham
Hi Dave, On Mon, Nov 17, 2008 at 6:35 AM, Dave Murray-Rust [EMAIL PROTECTED] wrote: I'm trying to plot multiple lines using different colours/symbols to distinguish them. If I try to plot more than 6 lines, I get an error: ggplot( dat, aes(x=time,y=value,group=variable,shape=variable) ) +

Re: [R] The use of F for False and T for True

2008-11-17 Thread hadley wickham
On Sun, Nov 16, 2008 at 7:41 PM, Simon Blomberg [EMAIL PROTECTED] wrote: It is better programming practice to use FALSE for false and TRUE for true, and not F and T. This is because it is quite legal to do this: T - FALSE F - TRUE It may be better programming practice, but is it better

Re: [R] An array of an array of boxplots in lattice

2008-11-17 Thread hadley wickham
On Mon, Nov 17, 2008 at 3:42 PM, steve [EMAIL PROTECTED] wrote: Thank you. Here's my version, using melt instead of do.call(make.groups... library(reshape) fgl2 = melt(fgl[,-10]) fgl2$type = fgl$type bwplot(value ~ type | variable, data = fgl2) Or even more succintly: fgl2 - melt(fgl, id =

Re: [R] ggplot2: can one have separate ylim for each facet?

2008-11-17 Thread hadley wickham
On Mon, Nov 17, 2008 at 3:49 PM, Etches Jacob [EMAIL PROTECTED] wrote: In lattice #toy data library(ggplot2) library(lattice) x - rnorm(100) y - rnorm(100) k - sample(c(Weak,Strong),100,replace=T) j - sample(c(Tall,Short),100,replace=T) w - data.frame(x,y,j,k)

Re: [R] Superimposing y-variables in Lattice formulas

2008-11-16 Thread hadley wickham
Hi Stavros, I think we're talking past each other on the question of the semantics of formula operators, and it's probably not productive to continue. I would guess that the underlying issue is that we come from different communities, and so have different background assumptions. Perhaps

Re: [R] Manipulating lists

2008-11-16 Thread hadley wickham
On Sun, Nov 16, 2008 at 9:56 PM, Christian Arnold [EMAIL PROTECTED] wrote: Hello R-Community, I am pretty new to R and I am fascinated what R can do! I am doing phylogenetic analysis in R, and my current project includes two problems that I am unable to solve, unfortunately. I am hoping that

Re: [R] TimeZone Help - Finding TimeZone codes

2008-11-13 Thread hadley wickham
On Thu, Nov 13, 2008 at 9:10 PM, J Dougherty [EMAIL PROTECTED] wrote: On Monday 10 November 2008 01:23:30 pm Prof Brian Ripley wrote: See ?Sys.timezone, which help.search(timezone) points you to. On Mon, 10 Nov 2008, stephen sefick wrote: I have looked at ?as.POSIXct That also links to

Re: [R] Citing R in journal articles (or the failure to)

2008-11-12 Thread hadley wickham
Along similar lines, someone recently posted a script to generate a .bib file for all packages installed. It would be useful if someone were to implement that script for CRAN and make the resulting R-packages.bib file available on the CRAN site. It would also be useful if citation() added a

Re: [R] Variable passed to function not used in function in select=... in subset

2008-11-11 Thread hadley wickham
I think your analysis is correct, that the goals of casual use and programming are inconsistent. But in general I think there's always going to be support for providing alternative ways that are programmer-safe. For instance, library( foo, character.only=TRUE) says that foo is a character

Re: [R] Reading tables using a truncated name

2008-11-11 Thread hadley wickham
?dir Hadley On Tue, Nov 11, 2008 at 11:06 AM, [EMAIL PROTECTED] wrote: Dear all, I am trying to read a bunch of csv files using read.table() that are named test_xx.csv where xx has no particular pattern. Is there a way of reading all the files by specifying a truncated file name

Re: [R] Variable passed to function not used in function in select=... in subset

2008-11-11 Thread hadley wickham
On Mon, Nov 10, 2008 at 1:04 PM, Wacek Kusnierczyk [EMAIL PROTECTED] wrote: pardon me, but does this address in any way the legitimate complaint of the rightfully confused user? consider the following: d = data.frame(a=1, b=2) a = c(a, b) z = a # that is, both a and z are c(a, b)

Re: [R] Reading tables using a truncated name

2008-11-11 Thread hadley wickham
Which can be simplified to: paths - dir(path = filePath, pattern = ^test_, full = T) lapply(paths, read.csv) Hadley On Tue, Nov 11, 2008 at 2:01 PM, [EMAIL PROTECTED] wrote: Hi all, Thanks everyone for your advice. They have been helpful. Just for the record, I am using ...

Re: [R] Variable passed to function not used in function in select=... in subset

2008-11-11 Thread hadley wickham
And without wanting to be rude or anything, your opinion carries very little weight in a project like R. You've arrived on the list and been very critical of the work of others. Now there is nothing wrong with being critical if it is constructive, and additionally with something like R you

Re: [R] R design (was Variable passed to function not used in function in select)

2008-11-11 Thread hadley wickham
That's why (I think) it should be an *** optional argument with default set to FALSE *** ... it's clear from the past traffic on the list (I won't take the time to dig up the thread references right now) that there is at the very least a significant minority of users who expect the opposite,

Re: [R] any alternatives for complex for-loops?

2008-11-11 Thread hadley wickham
On Tue, Nov 11, 2008 at 8:30 PM, Kinoko [EMAIL PROTECTED] wrote: Dear list, Is there a way to do something like the following pseudo-code - without for loop? There isn't a for loop in your code! Hadley complexFn - function(a,b){ ... return(c) } x[i] = complexFn(x[i-1], x[i-2]) I

Re: [R] how to stop without error message?

2008-11-10 Thread hadley wickham
On Mon, Nov 10, 2008 at 4:42 PM, [EMAIL PROTECTED] wrote: Dear list Can anyone suggest a simple way to abort execution like stop(...) does, but without issuing an Error: ... message? I don't want to set 'options( show.error.messages=TRUE)' because I want normal behaviour to resume after

Re: [R] how to stop without error message?

2008-11-10 Thread hadley wickham
I should have been clearer, sorry-- I'm trying to exit from an inner function which might be several levels deep, returning straight to the R prompt. To be specific, I'm trying to clean up the No Error in... message in my 'debug' package-- the No prefix being my original workaround to

Re: [R] Election Maps

2008-11-07 Thread hadley wickham
On Fri, Nov 7, 2008 at 7:53 AM, Duncan Murdoch [EMAIL PROTECTED] wrote: On 11/7/2008 8:31 AM, roger koenker wrote: Those of you with an interest in the US election and/or statistical graphics may find the maps at: http://www-personal.umich.edu/~mejn/election/2008/ interesting.

[R] Including graphics files in MS office / open office

2008-11-06 Thread hadley wickham
Hi all, I'm trying to write up some recommendations for what graphics formats are most useful for inclusion into ms office and openoffice. There have been a few discussions on the list in the past, but I haven't seen a summary. These are the options I've seen so far, along with there costs and

Re: [R] Including graphics files in MS office / open office

2008-11-06 Thread hadley wickham
On Thu, Nov 6, 2008 at 10:05 AM, Max Kuhn [EMAIL PROTECTED] wrote: * svg: R output devices still experimental I've been using the svg device in the Cairo package for a while now. I've never had any issues with it and wouldn't characterize it as experimental (of course, others may have had

Re: [R] Including graphics files in MS office / open office

2008-11-06 Thread hadley wickham
..°})) ) ) ) ) ) ( ( ( ( (Prof. Philippe Grosjean ) ) ) ) ) ( ( ( ( (Numerical Ecology of Aquatic Systems ) ) ) ) ) Mons-Hainaut University, Belgium ( ( ( ( ( .. hadley wickham wrote: Hi all, I'm trying to write up

Re: [R] TukeyHSD and 0.0000000

2008-11-05 Thread hadley wickham
On Wed, Nov 5, 2008 at 5:42 AM, Fredrik Karlsson [EMAIL PROTECTED] wrote: Dear list, Sorry to ask you this, but I just ran a TukeyHSD on an model with a two thee level factors as independent variables and a numeric score dependent variable. The aov gives a significant interaction effect, and

Re: [R] how can I save the estimates of a regression model in a file?

2008-11-05 Thread hadley wickham
On Wed, Nov 5, 2008 at 11:12 AM, pilar schneider [EMAIL PROTECTED] wrote: Dear all I need some help with R. How can I save the estimates of a regression model in a file? here is what I did: 1) this is my regression model: fit1 - lm(logmilk ~ logdays + days, data=data2) 2) however, I want

Re: [R] reshape bug?

2008-11-04 Thread hadley wickham
Hi Stephen, Thanks for the bug report (and apologies for the delay getting back to you). I'm working on a fix today and will hopefully release a new version in the very near future. Hadley On Fri, Oct 31, 2008 at 12:51 PM, stephen sefick [EMAIL PROTECTED] wrote: Hadley et al., I was using

Re: [R] ggplot2 scatterplot matrix

2008-11-04 Thread hadley wickham
plotmatrix(d[,3:6]) I would like to either have a colour or more preferably a shape to correspond to Site this is what I have tried (along with many other combinations) plotmatrix(nmds.bug[,3:6])+scale_shape(nmds.bug, shape=Site, pch=1:12) There's not really any easy way to do this in the

Re: [R] reshape bug?

2008-11-04 Thread hadley wickham
, hadley wickham [EMAIL PROTECTED] wrote: Hi Stephen, Thanks for the bug report (and apologies for the delay getting back to you). I'm working on a fix today and will hopefully release a new version in the very near future. Hadley On Fri, Oct 31, 2008 at 12:51 PM, stephen sefick [EMAIL

Re: [R] ggplot annotating charts

2008-11-04 Thread hadley wickham
Hi Simeon, Could you publish vixarchive.csv too please? Do you have a start on the version in ggplot2? It would be useful to see that code too. Hadley On Tue, Nov 4, 2008 at 8:49 AM, simeon duckworth [EMAIL PROTECTED] wrote: Dear R-listers I've been trying to figure out how to annotate

Re: [R] a date x-axis in a xyplot

2008-11-04 Thread hadley wickham
Is your variable actually a date? R doesn't recognise dates automatically - you need to create them with as.Date or similar. Hadley On Tue, Nov 4, 2008 at 3:22 AM, [EMAIL PROTECTED] wrote: Dear all, In the x-axis of a xyplot I define dates ,for example 01-10-2007 instead of numbers, in a

Re: [R] How do you apply a function to each variable in a data frame?

2008-11-03 Thread hadley wickham
On Mon, Nov 3, 2008 at 9:02 AM, Jorge Ivan Velez [EMAIL PROTECTED] wrote: Dear zerftezen, Try this: # Data set.seed(123) X=as.data.frame(matrix(rnorm(100),ncol=10)) # Percentiles 10 and 90 using apply t(apply(X,2,quantile,probs=c(0.1,0.9))) # The same using sapply

Re: [R] How to plot with different colours

2008-11-02 Thread hadley wickham
Hi Carlos, I'd strongly urge to reconsider your colour choices - 7-10% of males are red-green colour blind and it will be difficult for them to tell the difference between the high and low values. Hadley On Sat, Nov 1, 2008 at 11:58 PM, Carlos Morales [EMAIL PROTECTED] wrote: Hello everyone,

Re: [R] Splitting device for ggplots?

2008-11-01 Thread hadley wickham
On Sat, Nov 1, 2008 at 5:13 AM, baptiste auguie [EMAIL PROTECTED] wrote: Hi, I believe you can apply the same procedure as described in Paul Murrell's R graphics book for arranging lattice plots. Yup, and see also http://had.co.nz/ggplot2/book/grid.pdf Hadley -- http://had.co.nz/

Re: [R] Help needed with Waterfall plot

2008-11-01 Thread hadley wickham
On Fri, Oct 31, 2008 at 11:25 AM, Philip Twumasi-Ankrah [EMAIL PROTECTED] wrote: Hi friends, I need suggestions/directions on how to producing a waterfall plot for present extend of change in tumour size for a set of respondents in a study. Example of use of waterfall plot is in the

Re: [R] ggplot2: histogram with proportions (or %)

2008-10-30 Thread hadley wickham
On Thu, Oct 30, 2008 at 3:49 AM, ONKELINX, Thierry [EMAIL PROTECTED] wrote: Dear Bernd, AFAIK you can only get counts, densitys, counts scale to a maximum of 1 and likewise densitys. But you can alter the labels on the scales manually. Well, a proportion is just the count divided by the

Re: [R] combine symbol beta and text in ggplot2 and adjust size

2008-10-30 Thread hadley wickham
For this example: library(ggplot2) p - ggplot(mtcars, aes(x = wt, y=mpg)) + geom_point() p - p + scale_x_continuous(expression(beta)) p How can I include text with the expression. For example, level of \beta. Also, how can I increase Have a look at ?plotmath - you want something like

Re: [R] Subsetting data in a loop

2008-10-29 Thread hadley wickham
?split. Hadley On Wed, Oct 29, 2008 at 3:22 PM, t c [EMAIL PROTECTED] wrote: I need some help with sub-setting my data. I am trying to divide a data frame into multiple data frames based on the year collected, and stored in a list with each new data frame labeled with year X where X is the

Re: [R] ggplot2: how to combine position=stack and position=dodge in a single graph?

2008-10-28 Thread hadley wickham
On Fri, Oct 24, 2008 at 5:18 PM, Elena Schulz [EMAIL PROTECTED] wrote: Hi Hadley, thanks a lot for your quick answer. You should be able to replicate any dodging layout with facetting You mean instead of facetting by years, facetting by months? I will try this an see how the plot looks. I'd

Re: [R] does qplot works with Sweave?

2008-10-28 Thread hadley wickham
'plot' though. Is this a normal behaviour? \documentclass[9pt]{article} \title{ggplot2 example} \begin{document} \maketitle \section*{Examples of using ggplot2} The goal is to be able to import ggplot2 graphics into the annual report. Hadley Wickham has done a great job by creating

Re: [R] Process dataframes from list

2008-10-26 Thread hadley wickham
You might want to have a look at the plyr package - http://had.co.nz/plyr. The intro pdf describes a couple of problems that are similar to yours. Hadley On Sun, Oct 26, 2008 at 3:10 PM, Wade Wall [EMAIL PROTECTED] wrote: Hi all, I have roughly fifty dataframes and a dataframe with the names

Re: [R] getting the name of an object

2008-10-22 Thread hadley wickham
On Wed, Oct 22, 2008 at 9:34 AM, Duncan Murdoch [EMAIL PROTECTED] wrote: On 10/22/2008 10:02 AM, francois Guilhaumon wrote: Hello, I'm looking for a way to get the name of an object when it is used within an sapply. More precisely, with a simple example : I have a named list of objects :

Re: [R] Multi matrix row-wise mapply?

2008-10-21 Thread hadley wickham
On Tue, Oct 21, 2008 at 1:58 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi group! Suppose I have 2 matrices A and B of equal dimensions. I want to apply a function f to all corresponding pairs of rows from A and B in an efficient manner. Basically, I want mapply(f, data.frame(A),

Re: [R] GGPLOT/QPLOT Boxplot with summary

2008-10-21 Thread hadley wickham
Here's two quick thoughts: qplot(1, mpg, data=mtcars, geom=boxplot) + facet_grid(. ~ cyl, margins =T) qplot(factor(cyl), mpg, data=mtcars, geom=boxplot) + geom_boxplot(aes(x = all), width = 0.9) Hadley On Tue, Oct 21, 2008 at 12:41 PM, SalishSea [EMAIL PROTECTED] wrote: I'd like to generate a

Re: [R] Date classes in ggplot2

2008-10-19 Thread hadley wickham
On Sun, Oct 19, 2008 at 10:49 AM, stephen sefick [EMAIL PROTECTED] wrote: updn.gg - (structure(list(date = structure(c(11808, 11869, 11961, 11992, 12084, 12173, 12265, 12418, 12600, 12631, 12753, 12996, 13057, 13149), class = Date), unrestored = c(1.13789418691602, 0.704948049842955,

Re: [R] The evaluation of optional function arguments

2008-10-19 Thread hadley wickham
Why don't you want to do this? timesDefineInside - function(foo, bar...) { foo * bar } It seems like the obvious solution to your problem. Hadley On Sun, Oct 19, 2008 at 8:34 PM, Sietse Brouwer [EMAIL PROTECTED] wrote: Dear R-helpers, I've got two functions; callTimes() calls times(),

Re: [R] R plot

2008-10-17 Thread hadley wickham
On Fri, Oct 17, 2008 at 4:31 AM, Ted Harding [EMAIL PROTECTED] wrote: On 17-Oct-08 09:01:08, Benoit Boulinguiez wrote: Hi, Personally I always use xlim and ylim with the plot or points function like that: plot( X,Y,pch=16,col=2,cex.axis=1.5,cex.lab=1.5,

Re: [R] ggplot2 scale relation free

2008-10-17 Thread hadley wickham
. thanks agian On Fri, Oct 17, 2008 at 4:19 PM, hadley wickham [EMAIL PROTECTED] wrote: Hi Stephen, Thanks for the kind words about ggplot2 :) The next version of ggplot2 will implement the equivalent of scale relation free - I've just finished writing the bulk of the code and now I'm getting

Re: [R] using ifelse with surprising results

2008-10-17 Thread hadley wickham
On Fri, Oct 17, 2008 at 3:50 PM, [EMAIL PROTECTED] wrote: Thanks for the gracious assistance in advance I'm working on a non-metric scaling problem and am calculating the distance for input to isoMDS Here is the code library(MASS) vegdata - tapply(Percent, list(PRIMARY_VE, MASTERID),

Re: [R] correlation

2008-10-16 Thread hadley wickham
On Thu, Oct 16, 2008 at 8:05 AM, kdebusk [EMAIL PROTECTED] wrote: What test do I use to determine if there is a correlation between a discrete variable and a continuous variable? For example - I have water quality ratings for streams (excellent, good, fair, poor) and a corresponding nitrogen

Re: [R] Grouped Histogram (colored)

2008-10-16 Thread hadley wickham
On Thu, Oct 16, 2008 at 11:42 AM, x0rr0x [EMAIL PROTECTED] wrote: Hi all, I'm trying to create a histogram which shows the frequency of variables within a certain timeframe. I've been using SPSS before, but I didn't quite like it... To describe my problem further here are some example

Re: [R] request: How can we ignore a component of list having no element

2008-10-15 Thread hadley wickham
An alternative approach would be to store 0 x 0 matrices instead of NULLs. This way every object in your list is a consistent type. Hadley On Wed, Oct 15, 2008 at 5:23 AM, Muhammad Azam [EMAIL PROTECTED] wrote: Dear friends There is a list of arrays comprising different no of rows and columns

Re: [R] comparing with lead function

2008-10-15 Thread hadley wickham
On Wed, Oct 15, 2008 at 5:59 AM, Michael Pearmain [EMAIL PROTECTED] wrote: Hi All, I've been trying to compare if the previous value in a variable is equal to a binary value..(i.e i want to check if the last event was a yes or no) i've been trying to write some code for this, but it seems

Re: [R] combining same-day lab measurements with 'apply'

2008-10-15 Thread hadley wickham
Hi Dylan, You might want to have a look at the plyr package which is designed to make these sorts of tasks easier - http://had.co.nz/plyr. The site includes a ~20 page introductory pdf. Hadley On Wed, Oct 15, 2008 at 3:45 PM, dylan boyd [EMAIL PROTECTED] wrote: Another request for help

Re: [R] ggplot2 plot with symbols and then add line

2008-10-14 Thread hadley wickham
On Tue, Oct 14, 2008 at 6:46 AM, stephen sefick [EMAIL PROTECTED] wrote: r -(structure(list(TSS = c(2.8, 8.4, 11, 1.3, 4.2, 2, 3.4, 14, 8.2, 3.1, 1.4, 0.9, 0.5, 6.1, 9.2, 0.6, 1, 11, 2.4, 1.2, 1.3, 1.3, 0, 1.8, 8, 11, 11, 8.5, 8.5, 1.8, 13, 4.4, 1.4, 2.1, 0.5, 25, 25, 9.3, 6.1, 1.6, 1.5, 19,

Re: [R] A question about Heatmap for data with just 2 columns

2008-10-14 Thread hadley wickham
Why not use a scatterplot? That will be far far better for your purpose than a heatmap. Hadley On Tue, Oct 14, 2008 at 4:45 PM, feishi [EMAIL PROTECTED] wrote: Hi, I have a question about heatmap. I have a data with row as microRNA and two columns are two cell expression values for these

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