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

  • Home
  • SEARCH
  • 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 7000023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:37:04+00:00 2026-05-27T20:37:04+00:00

I’m trying to convert a time to seconds since midnight. I’m having a hard

  • 0

I’m trying to convert a time to seconds since midnight. I’m having a hard time getting the times() function from the chron package to work. Here’s how I’m using it:

> library(chron)
> 24 * 24 * 60 * (times(50))
Error in 24 * 24 * 60 * (times(50)) : 
  non-numeric argument to binary operator
> 
>  
> library(chron)
> 24 * 24 * 60  times(5000)
Error: unexpected symbol in "24 * 24 * 60  times"

Any suggestions?

UPDATE:

> sessionInfo()
R version 2.14.0 (2011-10-31)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] RODBC_1.3-3        nnet_7.3-1         doSNOW_1.0.3       foreach_1.3.0     
[5] codetools_0.2-8    iterators_1.0.3    snow_0.3-7         randomForest_4.6-2
[9] chron_2.3-42      

loaded via a namespace (and not attached):
[1] tools_2.14.0

UPDATE 2 :

> find("times")
[1] "package:foreach" "package:chron"  
> times
function (n) 
{
    if (!is.numeric(n) || length(n) != 1) 
        stop("n must be a numeric value")
    foreach(icount(n), .combine = "c")
}
<environment: namespace:foreach>

UPDATE 3:

> sessionInfo()
R version 2.14.0 (2011-10-31)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] chron_2.3-42
> find("times")
[1] "package:chron"
> 24 * 24 * 60 * (times * (50))
Error in times * (50) : non-numeric argument to binary operator
  • 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-27T20:37:04+00:00Added an answer on May 27, 2026 at 8:37 pm

    The problem is that package:foreach also contains a function named times. And because it appears before package:chron on your search path, it ‘masks’ the times function that you actually want.

    In other words, when R performs its dynamic search for the symbol times, it finds a match (the wrong one in this case) before it gets to the one associated with the function you’re intending it to find.

    You can see this by starting a fresh R session, and then typing:

    > library(chron)
    > library(foreach)
    Loading required package: iterators
    Loading required package: codetools
    foreach: simple, scalable parallel programming from Revolution Analytics
    Use Revolution R for scalability, fault tolerance and more.
    http://www.revolutionanalytics.com
    
    Attaching package: ‘foreach’
    
    The following object(s) are masked from ‘package:chron’:
    
        times
    

    If you do need both packages attached, you can ensure that you get the right version of times() by either: reversing the order in which the packages are attached (OK but not great); or (better) explicitly specifying which function you want by typing chron::times, as in:

    24 * 24 * 60 * (chron::times(50))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have a text area in my form which accepts all possible characters from

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.