Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8693087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:27:50+00:00 2026-06-13T00:27:50+00:00

I have a time series of continuous data measured at 10 minute intervals for

  • 0

I have a time series of continuous data measured at 10 minute intervals for a period of five months. For simplicity’s sake, the data is available in two columns as follows:

Timestamp   Temp.Diff
2/14/2011 19:00 -0.385
2/14/2011 19:10 -0.535
2/14/2011 19:20 -0.484
2/14/2011 19:30 -0.409
2/14/2011 19:40 -0.385
2/14/2011 19:50 -0.215

… And it goes on for the next five months. I have parsed the Timestamp column using as.POSIXct.

I want to select rows with certain times of the day, (e.g. from 12 noon to 3 PM), I would like either like to exclude the other hours of the day, OR just extract those 3 hours but still have the data flow sequentially (i.e. in a time series).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:27:51+00:00Added an answer on June 13, 2026 at 12:27 am

    You seem to know the basic idea, but are just missing the details. As you mentioned, we just transform the Timestamps into POSIX objects then subset.

    lubridate Solution

    The easiest way is probably with lubridate. First load the package:

    library(lubridate)
    

    Next convert the timestamp:

    ##*m*onth *d*ay *y*ear _ *h*our *m*inute
    d = mdy_hm(dd$Timestamp)
    

    Then we select what we want. In this case, I want any dates after 7:30pm (regardless of day):

    dd[hour(d) == 19 & minute(d) > 30 | hour(d) >= 20,]
    

    Base R solution

    First create an upper limit:

    lower = strptime("2/14/2011 19:30","%m/%d/%Y %H:%M")
    

    Next transform the Timestamps in POSIX objects:

    d = strptime(dd$Timestamp, "%m/%d/%Y %H:%M")
    

    Finally, a bit of dataframe subsetting:

    dd[format(d,"%H:%M") > format(lower,"%H:%M"),]
    

    Thanks to plannapus for this last part


    Data for the above example:

    dd = read.table(textConnection('Timestamp Temp.Diff
    "2/14/2011 19:00" -0.385
    "2/14/2011 19:10" -0.535
    "2/14/2011 19:20" -0.484
    "2/14/2011 19:30" -0.409
    "2/14/2011 19:40" -0.385
    "2/14/2011 19:50" -0.215'), header=TRUE)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two time series data frames: The first one: head(df1) : MSCI ACWI
I have two time series of data, one which is water temperature and the
I have a time series like this which consists of past 4 months (Feb,
I have a time series of two indexes, with each row representing the closing
I have a data.frame of a time series of data, I would like to
I have an irregular(?) time series data points in a day as following Jun
I have some time-series data that I'm fitting a loess curve in ggplot2, as
I have a time series(a csv file) data that looks like below. Each observation
i have a time series data like this: x <- structure(list(date = structure(c(1264572000, 1266202800,
I have a time series in the following format: time data value 733408.33 x1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.