- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试运行 Amelia 以使用以下代码在多个变量上估算一些缺失数据:
set.seed(1)zz[,c("id", "sex", "team", "minsSocial", "satisTravail", "performance")] <-Amelia::amelia(zz[,c("id", "sex", "team", "minsSocial", "satisTravail", "performance")],m=1, idvars="id", noms=c("sex","team"))$imputations$imp1
很遗憾,我收到此错误消息:
Erreur : 下标 AMr1.orig
是一个矩阵,数据 x.imp[, -possibleFactors][AMr1.orig]
的大小必须为 1。
关于问题出在哪里以及如何解决问题的任何问题?是不是因为我的数据包含值 <1?
谢谢!
最佳答案
我认为这可能是由于最近对小标题中的错误处理进行了一些更改。如果您将数据转换为 data.frame(假设 zz 是 tibble),错误应该会消失(这对我有用)。
zz <- as.data.frame(zz)
但不确定错误消息背后的原因。我从 rlang::last_error() 收到了类似的错误消息,并且代码适用于早期版本的包。
<error/tibble_error_subset_matrix_must_be_scalar>
Subscript `AMr1.orig` is a matrix, the data `x.imp[AMr1.orig]` must have size 1.
Backtrace:
1. Amelia::amelia(...)
2. Amelia::amelia.default(...)
3. base::lapply(seq_len(m), do.amelia)
4. Amelia:::FUN(X[[i]], ...)
5. Amelia:::impfill(...)
7. tibble:::`[<-.tbl_df`(...)
8. tibble:::tbl_subassign_matrix(x, j, value, j_arg, substitute(value))
关于error-handling - 如何修复错误 : Subscript `AMr1.orig` is a matrix, 数据 `x.imp[, -possibleFactors][AMr1.orig]` 的大小必须为 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64056125/
我正在尝试运行 Amelia 以使用以下代码在多个变量上估算一些缺失数据: set.seed(1)zz[,c("id", "sex", "team", "minsSocial", "satisTrav
我是一名优秀的程序员,十分优秀!