【发布时间】:2020-05-03 10:08:49
【问题描述】:
我有一个包含多张工作表的 Excel 数据。我将它们导入 R 并使用函数 sens.slope() 应用 Mann-Kendall 趋势测试。此函数的结果在 htest 类中,但我想将它们放在一个表格中。
我安装了所需的包并导入了每张数据集。
require(readxl)
require(trend)
tmin1 <- read_excel("C:/TEZ/ANALİZ/future_projection/2051-2100/model 3-3/average_tmin_3_3_end.xlsx", sheet = "acipayam")
tmin2 <- read_excel("C:/TEZ/ANALİZ/future_projection/2051-2100/model 3-3/average_tmin_3_3_end.xlsx", sheet = "adana")
...
tmin57 <- read_excel("C:/TEZ/ANALİZ/future_projection/2051-2100/model 3-3/average_tmin_3_3_end.xlsx", sheet = "yumurtalik")
然后,指定趋势测试的列。
x1<-tmin1$`13`
x2<-tmin1$`14`
x3<-tmin1$`15`
x4<-tmin1$`16`
x5<-tmin1$`17`
...
x281<-tmin57$`13`
x282<-tmin57$`14`
x283<-tmin57$`15`
x284<-tmin57$`16`
x285<-tmin57$`17`
并应用了函数。
sens.slope(x1)
sens.slope(x2)
sens.slope(x3)
....
sens.slope(x285)
结果是这样的。
> sens.slope(x1)
Sen's slope
data: x1
z = 4.6116, n = 49, p-value = 3.996e-06
alternative hypothesis: true z is not equal to 0
95 percent confidence interval:
0.03241168 0.08101651
sample estimates:
Sen's slope
0.05689083
> sens.slope(x2)
Sen's slope
data: x2
z = 6.8011, n = 49, p-value = 1.039e-11
alternative hypothesis: true z is not equal to 0
95 percent confidence interval:
0.05632911 0.08373755
sample estimates:
Sen's slope
0.07032428
...
如何将这些值放在一个表中并将它们写入 Excel 文件? (所需值的名称是函数中的 statistic 和 estimates。)
【问题讨论】: