r - 如何在忽略内部生成的索引的同时使用`boot`
问题描述
解决方案
你有一个 XY 问题。无需尝试覆盖索引,只需使用tidyr
's new nest/unnest 功能来进行集群引导,如下所示:
dNest = d %>% group_nest(cluster)
boot( data = dNest,
statistic = function(original, indices) {
bNest = original[indices,]
# "data" is an automatically generated column name in dNest
b = bNest %>% unnest(data)
return( my_stat(b) ) } )
或者,为了在集群引导之外获得更大的灵活性,您可以boot
从自己的重新采样中创建一个假对象。
推荐阅读
- r - lavaan 错误:模型是列表,但不是参数表?在 lavaan,Rstudio
- java - 如何修复线程“main”java.lang.StringIndexOutOfBoundsException中的异常:字符串索引超出范围:错误
- semantic-versioning - 如何在 Mac 上安装 gitversion?
- laravel - json列中的Laravel数据顺序
- debugging - 如何在 IntelliJ 中实时更新调试代码
- node.js - 设置 Access-Control-Allow-Origin 不起作用?
- python - 有没有办法在 Python 中复制任意生成器?
- python - “on_raw_reaction_add”有效而“and on_raw_reaction_remove”无效,为什么?
- python - 基于一列中的条件的 Python for 循环在另一列中返回结果
- xml - 如何使用脚本将 CAML 转换为纯文本?