Skip to content
Prev 273797 / 398506 Next

Find a particular point on a curve

On Oct 7, 2011, at 5:06 PM, Joanie wrote:

            
After making that data into a dataframe named "dat"
 > plot(dat)
 > min(which(dat$temperature <37.5))
[1] 72
 > max(which(dat$temperature >37.5))
[1] 2146
 > dat$time[ max(which(dat$temperature >37.5)) ]
[1] 40717.05
 > dat$time[ min(which(dat$temperature <37.5)) ]
[1] 40717.02
 > dat$time[ max(which(dat$temperature >37.5)) ]-dat 
$time[ min(which(dat$temperature <37.5)) ]
[1] 0.036644
 > sum(dat$temperature - 37.5)
[1] -441.2

 > # Units = degree-what .... minute? hours?, days?
 > sum(dat$temperature - 37.5)*(dat$time[ max(which(dat$temperature  
 >37.5)) ]-dat$time[ min(which(dat$temperature <37.5)) ])
[1] -16.16733

So the area under the curve is -16.16 degree-<some-time-units>  
(probably days)

You did not include the first request, which was something about the  
duration of time that the temperature was at the minimum value (there  
being no real plateau). Noting that the minumum (read off the plot)  
was 36.7) I find:

 > 60*24*(dat$time[ max(which(dat$temperature==36.7)) ]-dat 
$time[ which.min(dat$temperature) ])
[1] 1.65024    # minutes (I think) spend at the nadir of temperature