Re: [R] producing a master table from list of tables

2009-12-31 Thread david.schruth
No, that's basically the solution I had already come up with (see the last line of code from my original post) but, Yes, I'm thinking this might be the simplest way (even though it might not scale well to millions of elements ) On Dec 31, 1:17 pm, Dennis Murphy wrote: > Hi, > > Is this what you

Re: [R] xyplot - help with multiple Y's vs. X of a member data in multiple panels

2009-12-31 Thread jim holtman
I am not too sure if this is what you are after, but I just created a new factor for the panel: # create a new factor d1$newFactor <- factor(paste(d1$DS1, "+", d1$DS2, "+", d1$DS3)) xyplot(Y1+Y2+Y3~X1|newFactor,data=d1,group=ID) On Thu, Dec 31, 2009 at 6:25 AM, Santosh wrote: > Dear R experts,

Re: [R] iterating over a data frame the R way?

2009-12-31 Thread donahchoo
On Dec 31, 2009, at 5:46 PM, William Dunlap wrote: mytable$duration <- mytable$end_time - mytable$start_time mytable start_timeend_timeduration 1 2009-12-31 15:27:00 2009-12-31 15:27:00 0 secs 2 2009-12-31 16:27:00 2010-01-01 15:27:00 82800 secs ... 11 2010

Re: [R] iterating over a data frame the R way?

2009-12-31 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Gabor Grothendieck > Sent: Thursday, December 31, 2009 3:15 PM > To: donahc...@me.com > Cc: r-help@r-project.org > Subject: Re: [R] iterating over a data frame the R way? > > Thi

Re: [R] iterating over a data frame the R way?

2009-12-31 Thread Gabor Grothendieck
This iterates functions f over successive rows of mytable: apply(mytable, 1, f) or if you want to use SQL on R data frames then see sqldf http://sqldf.googlecode.com On Thu, Dec 31, 2009 at 5:52 PM, wrote: > In this specific case I'm going to do another select, from a different table > with th

Re: [R] How x[, 'colname1'] is implemented?

2009-12-31 Thread William Dunlap
Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Peng Yu > Sent: Thursday, December 31, 2009 2:16 PM > To: r-h...@stat.math.ethz.ch > Subject: [R] How x[, 'colname1'] i

Re: [R] iterating over a data frame the R way?

2009-12-31 Thread donahchoo
In this specific case I'm going to do another select, from a different table with the where clause being based on the start_time and end_time. select * from table_name where time >= start_time and time <= end_time; On Dec 31, 2009, at 3:57 PM, John Kane wrote: Uh what do you want to do to i

Re: [R] How x[, 'colname1'] is implemented?

2009-12-31 Thread Peng Yu
On Fri, Jan 1, 2010 at 4:24 PM, milton ruser wrote: > Hi Peng, > > If I undertood your point, try this: > > x<-runif(10) > y<-runif(10) > z<-runif(10) > w<-runif(10) > > myDF<-data.frame(cbind(x,y,z,w)) > myDF > > myDF[,c("w","z")] Thank you! But this is not what I'm asking. I want to know how R

Re: [R] How x[, 'colname1'] is implemented?

2009-12-31 Thread milton ruser
Hi Peng, If I undertood your point, try this: x<-runif(10) y<-runif(10) z<-runif(10) w<-runif(10) myDF<-data.frame(cbind(x,y,z,w)) myDF myDF[,c("w","z")] Happy new year miltinho On Thu, Dec 31, 2009 at 5:15 PM, Peng Yu wrote: > I don't see where describes the implementation of '[]'. > >

[R] How x[, 'colname1'] is implemented?

2009-12-31 Thread Peng Yu
I don't see where describes the implementation of '[]'. For example, if x is a matrix or a data.frame, how the lookup of 'colname1' is x[, 'colname1'] executed. Does R perform a lookup in the a hash of the colnames? Is the reference O(1) or O(n), where n is the second dim of x? __

Re: [R] expand.grid game

2009-12-31 Thread Brian Diggs
baptiste auguie wrote: > 2009/12/19 David Winsemius : >> On Dec 19, 2009, at 9:06 AM, baptiste auguie wrote: >> >>> Dear list, >>> >>> In a little numbers game, I've hit a performance snag and I'm not sure >>> how to code this in C. >>> >>> The game is the following: how many 8-digit numbers have t

Re: [R] iterating over a data frame the R way?

2009-12-31 Thread John Kane
Uh what do you want to do to it/them? Here are a couple of R-type commands on a data.frame. mydata <- data.frame(vec1 = seq(19,109, by=10), vec2 =seq(30,120, by=10)) mydata[,1]+mydata[,2] apply(mydata, 2, mean) --- On Thu, 12/31/09, donahc...@me.com wrote: > From: donahc...@me.com > Su

Re: [R] producing a master table from list of tables

2009-12-31 Thread Dennis Murphy
Hi, Is this what you wanted? untable <- function(tab) rep(names(tab), as.vector(tab)) lapply(my.table.list, untable) $x [1] "a" "a" "b" "b" "c" $y [1] "a" "a" "b" "c" "d" "d" $z [1] "c" "d" "d" HTH, Dennis On Thu, Dec 31, 2009 at 12:37 PM, david.schruth wrote: > Hello, > > I'm trying to co

[R] How to annotate lattice plots

2009-12-31 Thread James Rome
I am creating a lattice plot with with(ordgdp, xyplot(delivery~AAR | GDP_ID, xlab="AAR", ylab="Actual Arrival Rate")) which works, and gives me 48 plots, one for each GDP_ID. But I would like to put the number of hours that each GDP lasted on the relevant plot. This is given by the following table

[R] producing a master table from list of tables

2009-12-31 Thread david.schruth
Hello, I'm trying to construct an overall summary table from a list of tables. my.list <- list(x=c('a','b','a','b','c'), y=c ('a','d','c','a','b','d'),z=c('d','d','c')) my.table.list <- lapply(my.list, table) normally this might be really easy: master.table <- table(unlist(my.list)) But as it

[R] ggplot2: How to change font of labels in geom_text

2009-12-31 Thread Ronan Reilly
Happy New Year everyone. I have what I hope is a simple-to-answer question. In the code sample below, I'm using a tile plot to plot a continuous measure and overlaying the plot with labels. I need to print the labels in courier, but there appears to be no way to override the default font setting

Re: [R] cross validation for species distribution

2009-12-31 Thread Max Kuhn
You might want to be more specific about what you (exactly) intend to do. Reading the posting guide might help you get better answers. There are a few packages and functions to do what (I think) you desire. There is the train function in the caret package, the errorest function in ipred and

[R] iterating over a data frame the R way?

2009-12-31 Thread donahchoo
Hi, I have a data frame that was create by issuing a select against my sqlite database. I want to get each row from the data frame and use the each of the column values. The data frame looks like this: start_timeend_time 09:30:00 10:00:00 10:00:01 10:30:00 etc Can a point m

Re: [R] Obtaining partial output from a function that does not run to completion.

2009-12-31 Thread Eric
To heck with print(), use R's debugging capabilities instead: trace ( minBMI, browser ) Be sure to ?trace and ?browser so you can figure out how to interactively debug. Eric On 12/31/09 6:29 AM, John Sorkin wrote: I have written a function that contains runs lm() vif() and glm() When th

Re: [R] XML and RCurl: problem with encoding (htmlTreeParse)

2009-12-31 Thread Eduardo Leoni
In the meantime, try this. library(XML) theurl <- "http://www.aarresaari.net/jobboard/jobs.html"; download.file(theurl, "tmp.html") txt <- readLines("tmp.html") txt <- htmlTreeParse(txt, error=function(...){}, useInternalNodes = TRUE) g <- xpathSApply(txt, "//p", function(x) xmlValue(x)) head(grep

Re: [R] Obtaining partial output from a function that does not run to completion.

2009-12-31 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of John Sorkin > Sent: Thursday, December 31, 2009 6:30 AM > To: r-help@r-project.org > Subject: [R] Obtaining partial output from a function that > does not run to completion. > >

Re: [R] XML and RCurl: problem with encoding (htmlTreeParse)

2009-12-31 Thread Lauri Nikkinen
Thanks, looking forward to that! Happy New Year! -Lauri 2009/12/31 Duncan Temple Lang : > Hi Lauri. > > I am in the process of making some changes > to the encoding in the XML package. I'll take a look > over the next few days. (Not certain precisely when.) > >  D. > > > > Lauri Nikkinen wrote: >

Re: [R] How to interpret some diagnostic output

2009-12-31 Thread jim holtman
Try to not use 'attach', or if you do, at least do a 'detach'. Use 'with' or just fully qualify the names. 'attach' can lead to other problems. Every time you use it, you will get similar messages. On Thu, Dec 31, 2009 at 10:50 AM, Gerald I. Evenden < geraldi.even...@gmail.com> wrote: > I do no

Re: [R] Obtaining partial output from a function that does not run to completion.

2009-12-31 Thread Duncan Murdoch
John Sorkin wrote: Duncan, Thank you, however, if you will look at my function (bottom of this Email message), you will see that I have used print(). It appears that the print function is not run until the entire function completes running. No, statements are run in the order you give them

[R] How to interpret some diagnostic output

2009-12-31 Thread Gerald I. Evenden
I do not know if I have a problem or not. The R script at the end of this email seems to run properly and a I get a boxplot that looks proper but I get the long string of messages during execution of the script looking like: ... The following object(s) are masked from dat ( position 8 ) :

Re: [R] XML and RCurl: problem with encoding (htmlTreeParse)

2009-12-31 Thread Duncan Temple Lang
Hi Lauri. I am in the process of making some changes to the encoding in the XML package. I'll take a look over the next few days. (Not certain precisely when.) D. Lauri Nikkinen wrote: > Hi, > > I'm trying to get data from web page and modify it in R. I have a > problem with encoding. I'm no

Re: [R] Obtaining partial output from a function that does not run to completion.

2009-12-31 Thread John Sorkin
Duncan, Thank you, however, if you will look at my function (bottom of this Email message), you will see that I have used print(). It appears that the print function is not run until the entire function completes running. John John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics

Re: [R] Obtaining partial output from a function that does not run to completion.

2009-12-31 Thread David Winsemius
On Dec 31, 2009, at 8:29 AM, John Sorkin wrote: I have written a function that contains runs lm() vif() and glm() When the glm() blows up with an error message, I don't get the output from either the lm() or vf() even thought neither lm() nor vif() have any problems . How can I force the

Re: [R] Obtaining partial output from a function that does not run to completion.

2009-12-31 Thread Duncan Murdoch
On 31/12/2009 9:29 AM, John Sorkin wrote: I have written a function that contains runs lm() vif() and glm() When the glm() blows up with an error message, I don't get the output from either the lm() or vf() even thought neither lm() nor vif() have any problems . How can I force the function

Re: [R] newbie question

2009-12-31 Thread David Winsemius
Shall we assume that you are using a Mac? If so what version? This information would be neatly summarized if you posted the results of sessionInfo(). Using my web-browser I find there is no directory at R-Forge with this name: http://R-Forge.R-project.org/bin/macosx/universal/contrib/2.10

[R] Obtaining partial output from a function that does not run to completion.

2009-12-31 Thread John Sorkin
I have written a function that contains runs lm() vif() and glm() When the glm() blows up with an error message, I don't get the output from either the lm() or vf() even thought neither lm() nor vif() have any problems . How can I force the function to print sequential results rather than wait

Re: [R] Ops method does not dispatch on either of two classes

2009-12-31 Thread Jens Oehlschlägel
Thanks Brian, > This is as documented on the help page for Ops (the page in base, not > the one in Methods) which is linked from ?"|". For background you > should also read the reference on that help page. Unfortunately I have no access to that book. > You are wrong in asserting that the inte

[R] newbie question

2009-12-31 Thread André Deboer
Hello, When I install the package Rsafd, I get the following message. > install.packages("Rsafd",repos="http://R-Forge.R-project.org ",dependecies=TRUE) Warning in install.packages("Rsafd", repos = "http://R-Forge.R-project.org";, : argument 'lib' is missing: using '/Users/aajd/Library/R/2.10/l

[R] bulding your own tree

2009-12-31 Thread Albert Hupa
Hello everyone, I have a question about trees. I am writing my own clustering algorithm in R and I would like to save results to a tree, so that I could print it, just like hclust does. Basically this is agglomerative method for networks/matrices (I am writing it all on matrices, so no network pa

[R] XML and RCurl: problem with encoding (htmlTreeParse)

2009-12-31 Thread Lauri Nikkinen
Hi, I'm trying to get data from web page and modify it in R. I have a problem with encoding. I'm not able to get encoding right in htmlTreeParse command. See below > library(RCurl) > library(XML) > > site <- getURL("http://www.aarresaari.net/jobboard/jobs.html";) > txt <- readLines(tc <- textConn

[R] xyplot - help with multiple Y's vs. X of a member data in multiple panels

2009-12-31 Thread Santosh
Dear R experts, Wish you all a HAPPY NEW YEAR! How do I go about plotting (using lattice) overlays of an ID (group=ID) observed, fitted data in each panel of a multiple panel plot (each panel identified by DS1 + DS2 + DS3)? "x" variable is X1 in the accompanying section of a dataset. each individu

Re: [R] what don't I get about numeric/double comparisons in R way?

2009-12-31 Thread Peter Dalgaard
Peter Ehlers wrote: actual_mean <- mean( range) actual_sd <- sd( range) expected_mean <- 218.213483146067 expected_sd <- 159.277118043936 ... Your code is not reproducible, but it seems fairly clear that you haven't yet read the help pages for identical() and all.equal(); or, if you have, you

Re: [R] joining two lists...

2009-12-31 Thread milton ruser
Dear Steve, If I undertood you have a list of "data.frame"?. Have you tried: NewData<-rbind(data.frame(myData[1]),data.frame(myData[2])) Please, send us a str(object) so the experts can help you bests milton On Thu, Dec 31, 2009 at 1:05 AM, stevemew wrote: > > My "R" problem.. > > I want

[R] joining two lists...

2009-12-31 Thread stevemew
My "R" problem.. I want to join two lists but am so for not having any luck. Can anyone assist ? Variable: myData[1] "Data.Id" "Data.Length" "Data.Weight" "1" 12 12 "2" 45 23 Variable: myData[2] "Data.Id"