简体   繁体   English

曼肯德尔在 R

[英]Mann Kendall in R

I have a temperature data set for winter months over the time period from 1980 to 2019, for which I want to run the Mann Kendall test.我有一个从 1980 年到 2019 年的冬季月份的温度数据集,我想为此运行 Mann Kendall 测试。 The excel file has one column for dates and other for temperature. excel 文件有一列用于日期,另一列用于温度。 I am using R's Kendall package.我正在使用 R 的 Kendall package。 However, I am getting this error:但是,我收到此错误:

Error in Kendall(1:length(x), x): length(x)<3肯德尔错误(1:长度(x),x):长度(x)<3

As you state your problem one cannot reproduce it to see what is wrong.当您使用 state 时,您的问题无法重现以查看问题所在。 Reproducibility in coding problems is key for answers.编码问题的可重复性是答案的关键。 The best one can do given how you stated the problem is to guess.考虑到您如何陈述问题,最好的方法是猜测。 My guess is that you have a mistake in giving x the temperature data.我的猜测是你在给 x 温度数据时有一个错误。 Since you are importing the data into R via excel you need something like this:由于您通过 excel 将数据导入 R,因此您需要以下内容:

my_data<- read.csv("Your excel file name")
x<-my_data$Temperature
MannKendall(x)

If you provide your code I will give a better answer.如果您提供代码,我会给出更好的答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM