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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:28:21+00:00 2026-06-17T12:28:21+00:00

There is any R packages for calculation period of some function? I am looking

  • 0

There is any R packages for calculation period of some function? I am looking for r-function like this:

x <- seq(0, 50, by = 0.05)
y <- sin(x)
p <- calcPeriod(x, y) # result = 2pi
  • 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-17T12:28:22+00:00Added an answer on June 17, 2026 at 12:28 pm

    I think you are looking for something along the lines of a Fast Fourier Transform. I’m no expert, but I think you can do something along the lines of the following:

    x <- seq(0, 50, by = 0.05)
    y <- sin(x)
    
    calcPeriod <- function(x, y){
        incr <- x[2] - x[1]
        tmp <- spectrum(y, plot=FALSE)
        p <- (1/tmp$freq*incr)[which.max(tmp$spec)] # max of spectrum
        p
    }
    
    calcPeriod(x,y) # equals 6.4
    

    The function spectrumis actually a wrapper function for spec.pgram and spec.ar. Use with caution since the calcPeriodfunction is actually only identifying the maximum periodicity. For unevenly sampled series, a least-squares specrtal analysis would also identify the dominant periodicity (example link).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there any R packages for the calculation of Kendall's tau-b and tau-c, and
Are there any python packages to parse a Bibtex file, and output the result
Are there any packages that can take a directory full of source code (Objective-C
Are there any other packages for doing Venn diagrams in R besides the limma
Are there any good packages for colour palettes in R that can handle many
Are there any other similar packages that help identify and provide capabilities for browser
Are there any open source (or I guess commercial) packages that you can plug
Is there any way to disable certain metrics from selected packages in Sonar? I
Are there any working packages to change a linux user passwords using PHP? I've
Are there any python packages that help generating SQL queries from variables and classes?

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.