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

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

How to save the output results of Sen's Slope

问题

以下是翻译好的内容:

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

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

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

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

I am using this code to calculate Sen's Slope

  1. x1&lt;-data$Prec_45_BC
  2. 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.

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

答案1

得分: 1

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

  1. library('trend')
  2. data(maxau)
  3. out <- sens.slope(maxau[,"s"])
  4. out <- data.frame(unlist(out))
  5. 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:

  1. library(&#39;trend&#39;)
  2. data(maxau)
  3. out &lt;- sens.slope(maxau[,&quot;s&quot;])
  4. out &lt;- data.frame(unlist(out))
  5. 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:

确定