【问题标题】:How to nest quantile() function within apply() function in R or RStudio如何在 R 或 RStudio 中的 apply() 函数中嵌套 quantile() 函数
【发布时间】:2015-01-22 07:14:33
【问题描述】:

如何在 R Studio 的 tapply() 中嵌套 quantile()?

鉴于

tapply(data$x,data$y, quantile)

这行得通,但它提供标准的 quin-tiles。我想选择自定义百分位数。我怎样才能将这样的东西(下面)合并到上面的脚本行中?

quantile(data$x, c(0.1,.2,.8,0.9), na.rm=TRUE)

当我尝试合并这些时,我收到错误消息“match.fun(FUN)...not a function”

有什么想法吗?谢谢,

【问题讨论】:

    标签: r console rstudio apply quantile


    【解决方案1】:

    tapply(data$x, data$y, quantile, probs=c(0.1,.2,.8,0.9), na.rm=TRUE)?

    【讨论】:

      猜你喜欢
      • 2010-09-10
      • 1970-01-01
      • 2019-04-03
      • 2022-03-28
      • 2018-11-15
      • 1970-01-01
      • 2015-04-11
      • 1970-01-01
      • 2022-12-14
      相关资源
      最近更新 更多