如何保存Sen’s Slope的输出结果

huangapple go评论84阅读模式
英文:

How to save the output results of Sen's Slope

问题

以下是翻译好的内容:

我正在使用这段代码来计算Sen's Slope

x1<-data$Prec_45_BC
Prec45<- sens.slope(x1)

它的输出结果如下。我如何将它们保存成表格形式并进一步导出为CSV。

data:  x1
z = -1.7156, n = 430, p-value = 0.08624
alternative hypothesis: true z is not equal to 0
95 percent confidence interval:
 -0.025611763  0.002016025
sample estimates:
Sen's slope 
-0.01234117
英文:

I am using this code to calculate Sen's Slope

x1&lt;-data$Prec_45_BC
Prec45&lt;- sens.slope(x1)

Its output results are as below. How can I save them in the table form and further export them to CSV.

data:  x1
z = -1.7156, n = 430, p-value = 0.08624
alternative hypothesis: true z is not equal to 0
95 percent confidence interval:
 -0.025611763  0.002016025
sample estimates:
Sen&#39;s slope 
-0.01234117 

答案1

得分: 1

这里的问题似乎是数据首先必须被取消列出,才能将其写入CSV。以下示例代码允许将Sen的斜率输出保存为CSV:

library('trend')

data(maxau)
out <- sens.slope(maxau[,"s"])
out <- data.frame(unlist(out))

write.csv(out, "out.csv")

但是,我不太确定"以表格形式保存"是什么意思。

英文:

The issue here seems to be that the data first has to be unlisted in order to write it as a CSV. The following example code allows for saving the output of Sen's Slope to a CSV:

library(&#39;trend&#39;)

data(maxau)
out &lt;- sens.slope(maxau[,&quot;s&quot;])
out &lt;- data.frame(unlist(out))

write.csv(out, &quot;out.csv&quot;)

However, I'm not fully sure what was meant by saving it "in the table form".

huangapple
  • 本文由 发表于 2023年7月14日 08:32:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/76684023.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定