Dear R users, Can anyone help me with mann-kendall trend test? I tried to use the newest packages 'trend', and the function mk.test, but had problems in applying the input data. For example, res <- mk.test(Nile), Nile is a time-series data. But when I use my dataset, with one column which is a time-series data, it says "error: input must be ts object". How to do this? Thanks for your help. [[alternative HTML version deleted]]
Not reproducible. Use dput to generate R code form of your data along with the code that gave you the error, and set the email to plain text only when you send it so it doesn't get corrupted when the html is stripped on the mailing list. -- Sent from my phone. Please excuse my brevity. On June 17, 2016 12:47:07 PM PDT, lily li <chocold12 at gmail.com> wrote:>Dear R users, > >Can anyone help me with mann-kendall trend test? I tried to use the >newest >packages 'trend', and the function mk.test, but had problems in >applying >the input data. > >For example, res <- mk.test(Nile), Nile is a time-series data. But when >I >use my dataset, with one column which is a time-series data, it says >"error: input must be ts object". How to do this? Thanks for your help. > > [[alternative HTML version deleted]] > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.[[alternative HTML version deleted]]
Dear, You have to store your data as a Time-Series (ts), first.?To define a column of data as ts, you may use this: library(timeSeries)Nile <- read.csv(file.choose(), header=F)#If your data is monthly, you may define the frequency as 12, for annual ts set freq. as 1. #If your data starts from for e.g., 1990, then:NileTS <- ts(Nile, frequency=1, start=c(1990,1))#To plot the time seriesplot.ts(NileTS) Morteza ? On Saturday, June 18, 2016 3:47 AM, lily li <chocold12 at gmail.com> wrote: Dear R users, Can anyone help me with mann-kendall trend test? I tried to use the newest packages 'trend', and the function mk.test, but had problems in applying the input data. For example, res <- mk.test(Nile), Nile is a time-series data. But when I use my dataset, with one column which is a time-series data, it says "error: input must be ts object". How to do this? Thanks for your help. ??? [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]]