Re: [R] How to extract information from the following dataset?

From: hwright <>
Date: Thu, 12 May 2011 03:18:53 -0700 (PDT)

I have the following data set, in a csv file, looks like the following:

Jan 27, 2010 16:01:24,000 125 - - -
Jan 27, 2010 16:06:24,000 125 - - -
The first few columns are month, day, year, time with OS3 accuracy. And the last number is the measurement I need to extract. I wonder if there is a easy way to just take out the measurements only from a specific day and hour

Xin Zhang
Ph.D Candidate
Department of Statistics
University of California, Riverside

I use strptime to configure the date format in my times series dataset.
First check to see how the dates are read.
For example:

# check the structure
str(your_file) 'data.frame' ...etc This tells me that my original date is a factor but not in POSIXlt format.
#check your column dates
head(your_file) [1] "1984-01-26" "1984-02-09" "1984-03-01" "1984-03-15" "1984-03-29" "1984-04-12" These are discrete column dates.
#convert your date format
your_file$date<- strptime(your_file$date,"%m/%d/%Y") call ?strptime for options Example: For a specific day or hour, strptime would utilize: strptime(your_file$date,"%d/%I") for day and hour. Once you extract the type of date format you want, run str(your_file) again to confirm the format change. Does this answer your question? Best, ----- ------------------------------- Heather A. Wright, PhD candidate Ecology and Evolution of Plankton Stazione Zoologica Anton Dohrn Villa Comunale 80121 - Napoli, Italy -- View this message in context: Sent from the R help mailing list archive at ______________________________________________ mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code.
Received on Thu 12 May 2011 - 11:03:05 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 12 May 2011 - 12:20:06 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive