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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:30:23+00:00 2026-05-27T08:30:23+00:00

I need to apply the Mann Kendall trend test in R to a big

  • 0

I need to apply the Mann Kendall trend test in R to a big number (about 1 million) of different-sized time series. I’ve already created a script that takes the time-series (practically a list of numbers) from all the files in a certain directory and then outputs the results to a .txt file.

The problem is that I have about 1 million of time-series so creating 1 million of file isn’t exactly nice. So I thought that putting all the time-series in only one .txt file (separated by some symbol like “#” for example) could be more manageable. So I have a file like this:

1
2
4
5
4
#
2
13
34
#
...

I’m wondering, is it possible to extract such series (between two “#”) in R and then apply the analysis?

EDIT

Following @acesnap hints I’m using this code:

library(Kendall)
a=read.table("to_r.txt")
numData=1017135

for (i in 1:numData){

s1=subset(a,a$V1==i)
m=MannKendall(s1$V2)
cat(m[[1]],"  ",m[[2]], "  ", m[[3]],"  ",m[[4]],"  ", m[[5]], "\n" ,   file="monotonic_trend_checking.txt",append=TRUE)
}

This approach works but the problem is that it is taking ages for computation. Can you suggest a faster approach?

  • 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-27T08:30:23+00:00Added an answer on May 27, 2026 at 8:30 am

    If you were to number the datasets as they went into the larger file it would make things easier. If you were to do that you could use a for loop and subsetting.

    setNum        data
      1            1
      1            2
      1            4
      1            5
      1            4
      2            2
      2           13
      2           34
     ...          ...
    

    Then do something like:

    answers1 <- c()  
    numOfDataSets <- 1000000
    for(i in 1:numOfDataSets){
      ss1 <- subset(bigData, bigData$setNum == i) ## creates subset of each data set
      ans1 <- mannKendallTrendTest(ss1$data)      ## gets answer from test
      answers1 <- c(answers1, ans1)               ## inserts answer into vector
      print(paste(i, " | ", ans1, "",sep="" ))    ## prints which data set is in use
      flush.console()                             ## prints to console now instead of waiting
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to apply the Mann Kendall trend test in R to a big
I need to apply validation on input time intervals that are taken in as
I have 7 million+ records that i need to apply multiple formula to it.
I need to apply a tooltip plugin to a bunch of different elements on
I need to apply AJAX loader that loads some different contents form the page,
I need to apply a different class to a <tr> according to the $index
Need to apply a filter to a file like this: TUPAC_0006:1:1:2554:2356#0/1 0 * 0
I need to apply tint effect on image in Android . But the tint
I need to apply paragraph formatting to a selection in a rich text box.
I need to apply/remove to an input field according to a user's selection in

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.