[R] Transfer function observed vs predicted values graph problem

2011-02-22 Thread Matt Coe
Hi, I am trying to make a palaeoenvironmental transfer function using the R package rioja that predicts the water-table (measured as depth to the water table) of an area given the testate amoebae that are found there. I've carried out weighted averaging of the data and am trying to produce a graph

Re: [R] question regarding basic stat question

2011-02-22 Thread Daniel Harris
The first column gives the answer that I am looking for but I just thought their maybe a better way without using the long variable Sounds like you want the frequency-weighted summary statistics. For the mean, look at ?weighted.mean. For more comprehensive stats, check ?wtd.mean in the Hmisc

Re: [R] Random Forest Cross Validation

2011-02-22 Thread ronzhao
Thanks, Max. Yes, I did some feature selections in the training set. Basically, I selected the top 1000 SNPs based on OOB error and grow the forest using training set, then using the test set to validate the forest grown. But if I do the same thing in test set, the top SNPs would be different

[R] Plot Stepped Line chart with multiple lines

2011-02-22 Thread Techni X
Hi all, I have a question, that might be a „rookie“ question – but I’m trying now for days and cannot get my head around. The general question is: How can I plot a stepped line chart with multiple lines from a subset of a dataframe? An example: d - matrix(rep(0,24), ncol=3, nrow=8) d -

Re: [R] Transforming relational data

2011-02-22 Thread mathijsdevaan
Gabor, that worked great! I was unaware of the sqldf package, but it is great for data manipulation. Thanks! -- View this message in context: http://r.789695.n4.nabble.com/Re-Transforming-relational-data-tp3307449p3320067.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] aggregate in R

2011-02-22 Thread Ista Zahn
Hi Gary, I'm not sure if you can do that with aggregate. You might have to resort to something like tmp - cbind(aggregate(y$a, by=list(y$x), mean), aggregate(y$b, by=list(y$x), sum)$x) names(tmp) - c(x, mean.a, sum.b) tmp Or, using the plyr package: library(plyr) ddply(y, .(x), summarize,

Re: [R] aggregate in R

2011-02-22 Thread Seeliger . Curt
Gary/Hongwei writes: I'm wondering how I can aggregate data in R with different functions for different columns. For example: x-rep(1:5,3) y-cbind(x,a=1:15,b=21:35) y-data.frame(y) I want to aggregate a and b in y by x. With a, I want to use function mean; with b, I want to use function

Re: [R] aggregate in R

2011-02-22 Thread jim holtman
try data.table: x a b 1 1 1 21 2 2 2 22 3 3 3 23 4 4 4 24 5 5 5 25 6 1 6 26 7 2 7 27 8 3 8 28 9 4 9 29 10 5 10 30 11 1 11 31 12 2 12 32 13 3 13 33 14 4 14 34 15 5 15 35 require(data.table) Loading required package: data.table Quick start guide : vignette(datatable-intro)

[R] add repeated rows in data frame (without a loop)

2011-02-22 Thread Nicolas Gutierrez
Hi All, I have a data frame pop: id xloc yloc size 1 1 101295 2 211 1081 And I want to add the vector rec to the data frame n times (without using a loop): rec=c(3, 5, 5, 10) n=2 The result I want: id xloc yloc size 1 1 1012 95 2

Re: [R] aggregate in R

2011-02-22 Thread Jeff Newmiller
Use ?plyr::ddply --- Jeff Newmiller The . . Go Live... DCN:jdnew...@dcn.davis.ca.us Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded

Re: [R] aggregate in R

2011-02-22 Thread Jannis
The documentation of aggregate tells you that your way will not work. Why don't you aggregate/sum the columns separately? I would doubt that what you want to try to achieve in one go is already implemented somewhere Jannis --- Hongwei Dong pdxd...@gmail.com schrieb am Di, 22.2.2011:

Re: [R] Plot Stepped Line chart with multiple lines

2011-02-22 Thread Ista Zahn
Hi, This is R, so there are bound to be severay ways to do it. This would be my first choice: library(ggplot2) ggplot(d, aes(x=V2, y=V3, color=V1)) + geom_step() Best, Ista On Tue, Feb 22, 2011 at 3:08 PM, Techni X fiboswo...@yahoo.com wrote: Hi all, I have a question, that might be a

Re: [R] Random Forest Cross Validation

2011-02-22 Thread mxkuhn
If you want to get honest estimates of accuracy, you should repeat the feature selection within the resampling (not the test set). You will get different lists each time, but that's the point. Right now you are not capturing that uncertainty which is why the oob and test set results differ so

Re: [R] odfWeave graphics glitch

2011-02-22 Thread mxkuhn
John, What version of odfWeave and OO are you using? Thanks, Max On Feb 22, 2011, at 3:17 PM, Prof. John C Nash nas...@uottawa.ca wrote: Using R2.12.1 on Ubuntu 10.04.1 I've tried to run the following code chunk in odfWeave fig1, echo=TRUE,fig=TRUE,width=7,height=4= x-seq(1:100)/10

Re: [R] Transforming relational data

2011-02-22 Thread Matthew Dowle
Thanks. How about this? DT$B = factor(DT$B) firststep = DT[,cbind(expand.grid(B,B),v=1/length(B),C=C[1]),by=A][Var1! =Var2] setkey(firststep,Var1,Var2,C) firststep = firststep[,transform(.SD,cv=cumsum(v)),by=list(Var1,Var2)] setkey(firststep,Var1,Var2,C) DT[,

[R] ggplot2 directional line type?

2011-02-22 Thread Malcolm Ryan
I'm doing a path plot with ggplot2, the result is looking very nice, but I want to give some indication of which direction the lines are going. I thought of using colour gradients, but it doesn't look right. What would be ideal is a line type that indicated direction, something like . Is there

Re: [R] Plot Stepped Line chart with multiple lines

2011-02-22 Thread David Winsemius
On Feb 22, 2011, at 7:10 PM, Ista Zahn wrote: Hi, This is R, so there are bound to be severay ways to do it. This would be my first choice: library(ggplot2) ggplot(d, aes(x=V2, y=V3, color=V1)) + geom_step() Best, Ista On Tue, Feb 22, 2011 at 3:08 PM, Techni X fiboswo...@yahoo.com wrote:

Re: [R] add repeated rows in data frame (without a loop)

2011-02-22 Thread Peter Ehlers
On 2011-02-22 14:48, Nicolas Gutierrez wrote: Hi All, I have a data frame pop: id xloc yloc size 1 1 101295 2 211 1081 And I want to add the vector rec to the data frame n times (without using a loop): rec=c(3, 5, 5, 10) n=2 The result I

Re: [R] ggplot2 directional line type?

2011-02-22 Thread baptiste auguie
Hi, You could add arrows with geom_segment; however if you want even spacing along the path it might get tricky, library(ggplot2) d - data.frame(x=seq(0, 10, length=100), y=sin(seq(0, 10, length=100))) N - 10 dN - 2 ind - seq(1,nrow(d),by=N) ind - ind[-c(1,length(ind))] d3 -

Re: [R] difference in pairs ?

2011-02-22 Thread Peter Ehlers
On 2011-02-22 12:51, Vlatka Matkovic Puljic wrote: Well, it should be difference by ID and TIME for q1: something like: for ID 1187 in TIME 1 q1=3 and TIME 2 (for same ID) q1=3 so diff would be 3-3=0 TIME ID q1 1 1187 3 1 1187 3 And I don't know how to make

Re: [R] how can I connect paired points within lattice bwplot?

2011-02-22 Thread Peter Ehlers
On 2011-02-22 11:52, Cory Champagne wrote: Hello all, my first post to this list. I do a lot of experiments using a paired sampling design and I would get a lot of mileage out of figures like this, if I can make it work! Any advice would be appreciated. my email is: cory.champ...@gmail.com.

Re: [R] how can I connect paired points within lattice bwplot?

2011-02-22 Thread Deepayan Sarkar
On Wed, Feb 23, 2011 at 8:01 AM, Peter Ehlers ehl...@ucalgary.ca wrote: On 2011-02-22 11:52, Cory Champagne wrote: Hello all, my first post to this list.  I do a lot of experiments using a paired sampling design and I would get a lot of mileage out of figures like this, if I can make it

Re: [R] aggregate in R

2011-02-22 Thread Sebastián Daza
plyr is very useful to aggregate data... I strongly recommend it. On 2/22/2011 5:59 PM, Jeff Newmiller wrote: Use ?plyr::ddply --- Jeff Newmiller The . . Go Live... DCN:jdnew...@dcn.davis.ca.us Basics: ##.#. ##.#.

Re: [R] How to find points of intersection between harmonic function and a line

2011-02-22 Thread rex.dwyer
How is the curve is represented? That's more important that its organ-of-origin. If you have values of y=f(x) at discrete time points, then y-(x+2) will change sign sometimes... the intersection point is at some time x' in between. Am I missing something subtle here? You could interpolate the

[R] mgcv: beta coefficient and 95%CI

2011-02-22 Thread clc
Hi i am doing an environmental research The equation is as follow: gam(y1 ~ x1 + s(x2) + s(x3) + s(x4), family = gaussian, fit = true) I would like to obtain the beta coefficient and 95CI of x4 (or s(x4)), what should I do? Thanks, Lung -- View this message in context:

Re: [R] add repeated rows in data frame (without a loop)

2011-02-22 Thread Nicolas Gutierrez
That worked.. thanks Peter On 2/22/2011 5:40 PM, Peter Ehlers wrote: popm - as.matrix(pop) recm - matrix(rep(rec, n), nr=n, byrow=TRUE) newpop - data.frame(rbind(popm, recm)) __ R-help@r-project.org mailing list

[R] sum data from data.frame in a matrix

2011-02-22 Thread Nicolas Gutierrez
Hi all (again), I have a data frame pop: xloc yloc yield 1 101295 2 111081 3 121120 4 121110 And I want to get the sum of yield for the cell (pop$xloc, pop$yloc) in a matrix as follows: xloc 10 11 12 10 0 81 0 yloc

<    1   2