[R] Data Parameter extract

David Winsemius dwinsemius at comcast.net
Fri Oct 15 04:46:06 CEST 2010


On Oct 14, 2010, at 8:56 PM, joeman3285 wrote:

>
> Hi,
> So I have a set of data, hourly temperature, where each temperature  
> is set
> up like this:
>
> Time     Temp
> 1.04        8
> 1.08        10
>
> etc.  Where "1" corresponds to a day (say monday is "1", tuesday is  
> "2") and
> the decimal value corresponds to an the hour of the day.
>
> I have several thousand of these readings over several months.  What  
> I would
> like to do is extract daily minimum temperatures from this data set.

>  Is this possible to do with R?
>
> I'm pretty new to the use of R and have only a basic understanding  
> of how it
> all works.

One way that works best is for questions to include data in an R  
object. If those values are in a data.frame, dfrm, (and if they're  
not, then you need to work through some examples in the Introduction  
to R and the Import/Export Manual)  then:

dput(head(dfrm, 20)) # would get a version of the data that anyone  
could paste into their console.

Still assuming you have this in a data.frame, perhaps:

mintemps <- with( dfrm, tapply( Temp, floor(Time) , min) )
mintemps

>
> I appreciate any help.
>
> -joe
> -- 
> View this message in context: http://r.789695.n4.nabble.com/Data-Parameter-extract-tp2996369p2996369.html
> Sent from the R help mailing list archive at Nabble.com.
######
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
                                     
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> and provide commented, minimal, self-contained, reproducible code.


-- 
David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list