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 7196595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:48:26+00:00 2026-05-28T20:48:26+00:00

I am trying to understand from this example if lubridate can be applied to

  • 0

I am trying to understand from this example if lubridate can be applied to apply.daily but don’t quite understand how to do that.
can I get any reference to using lubridate with apply.daily so I can exclude weekends using apply.daily

Stackoverflow: Wrong week-ending date using ‘to.weekly’ function in ‘xts’ package

EDIT: using Richie Cotton’s example as a guide, I wrote the following:

> is.weekend <- function(x) {

+    w <- as.POSIXlt(x)

+    w %in% c(1,7)

+ }

> apply.daily(core[!is.weekend(x)],dfun)

Error in as.POSIXlt.default(x) :

  do not know how to convert 'x' to class "POSIXlt"

> apply.daily(core[!is.weekend(index(x))],dfun)

Error in as.POSIXlt.numeric(x) : 'origin' must be supplied

> alpha <- core[!is.weekend(index(x))]

Error in as.POSIXlt.numeric(x) : 'origin' must be supplied

> 

Where is my error? Am I missing a particular library?

  • 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-05-28T20:48:27+00:00Added an answer on May 28, 2026 at 8:48 pm

    Create your time series.

    x <- today() + hours(0:(24 * 14))
    time_series <- xts(rnorm(length(x)), x)
    

    Write a function to check whether a date occurs on a weekend.

    is.weekend <- function(x)
    {
      day_of_week <- wday(x, label = TRUE)
      day_of_week %in% c("Sat", "Sun")
    }
    

    Exclude those from your call to apply.daily.

    apply.daily(time_series[!is.weekend(x)], max)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to follow this example but I can't understand this part: Imagine
I'm trying to understand this but I didn't get any appropriate results from searching.
This is a stupid example but I'm trying to understand how thing get passed
I'm trying to understand the documentation from Android for Sensor.TYPE_ACCELEROMETER: It gives this example:
I don't know much about database optimization, but I'm trying to understand this case.
I've been trying to understand this example Ruby code from a blog entry which
I am trying to understand this inline assembly code which comes from _hypercall0 here
I'am trying to understand the example from program_options of the boost library ( http://www.boost.org/doc/libs/1_38_0/doc/html/program_options/tutorial.html#id3761458
I am trying to understand this example code regarding Browser Helper Objects. Inside, the
I have been trying to understand how to return links from yql results, but

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.