stan-dev/posterior

[FR?] rvar works in data.frame but not data.table

オープン

#234 opened on 2022/04/05

 (8 件のコメント) (0 件のリアクション) (0 人の担当者)R (26 件のフォーク)github user discovery
help wanted

Repository metrics

Stars
 (171 個のスター)
PR merge metrics
 (平均マージ 8d 3h) (30d で 1 merged PR)

説明

Not sure if this is a posterior issue or data.table issue but it looks like you cannot put rvars into data.table but it does work with data.frame

library(data.table)
library(posterior)
n <- 4   # length of output vector
x_rvar <- rvar(array(rnorm(4000*n, mean = 1, sd = 1), dim = c(4000, n)))
x_rvar
# rvar<4000>[4] mean ± sd:
#   [1] 0.98 ± 1.00  1.00 ± 1.02  1.00 ± 0.99  0.99 ± 0.99 
# does not work :(
ex_dt = data.table(ex = x_rvar)
ex_dt
# Empty data.table (0 rows and 1 cols): ex
# does work
ex_df = data.frame(ex = x_rvar)
ex_df
# ex
# 1 0.9778591 ± 1.0010389
# 2 1.0015836 ± 1.0206705
# 3 0.9964342 ± 0.9948071
# 4 0.9947569 ± 0.9921549

コントリビューターガイド