Re: [R] Calculating differences

2011-10-22 Thread Jeffrey Joh
? If I wanted to make 50 separate plots for 50 different dates, how can I do that? Jeffrey > Date: Thu, 20 Oct 2011 17:39:42 -0700 > Subject: Re: [R] Calculating differences > From: djmu...@gmail.com > To: johjeff...@hotmail.com &g

Re: [R] Calculating differences

2011-10-20 Thread Dennis Murphy
Hi: Here's one way with the plyr package. Using ds as the name of your data frame (thank you for the dput and clear description of what you wanted, BTW), library('plyr') ddply(ds, .(date), mutate, minspd = min(speed), Cmin = C[which.min(speed)], diff = C - Cmin) speed C house date houri

Re: [R] Calculating differences

2011-10-20 Thread R. Michael Weylandt
I'd dont quite get what you are asking, but here's my best guess and you can tweak it go get what you need. I'd do it in two passes since you want two rather unrelated objects. structure(list(speed = c(3,9,4,8,7,6), C = c(0.697, 0.011, 0.015, 0.012, 0.018, 0.019), house = c(1, 1, 1, 1, 1, 1), dat

[R] Calculating differences

2011-10-20 Thread Jeffrey Joh
I have a table that looks like this: structure(list(speed = c(3,9,4,8,7,6), C = c(0.697, 0.011, 0.015, 0.012, 0.018, 0.019), house = c(1, 1, 1, 1, 1, 1), date = c(719, 1027, 1027, 1027, 1030, 1030), hour = c(18, 8, 8, 8, 11, 11), id = c("1000", "1", "10001", "10002", "10003", "100