在 R 版本 4.4.2 (2024-10-31) 下 -- “Pile of Leaves”,最新的 macos
$ R --vanilla
> load(file="tttdf")
> str(ttt)
'data.frame': 3 obs. of 17 variables:
$ .mn.r : num 0 0 0
$ .sd.r : num 0 0 0
$ .mn.g : num 0 0 0
$ .sd.g : num 0 0 0
$ .cor.r.g : num 1 1 1
$ sep : num -1 -1 -1
$ beta.g.ldp : num 0 0 0
$ beta.dp.ldp: num 1 1 1
$ beta.r.ldp : num 0 0 0
$ sep : num -2 -2 -2
$ lastdpr : num -3 -5 -6
$ declinedpr : num 0 2 3
$ sep : num -3 -3 -3
$ beta.r.lr : num 0 0 0
$ beta.g.lg : num 0 0 0
$ beta.g.lr : num 0 0 0
$ beta.r.lg : num 0 0 0
ttt <- within(ttt, hello <- 22)
Error in `[<-.data.frame`(`*tmp*`, nl, value = list(hello = 22, .mn.r = c(0, :
duplicate subscripts for columns
> ## make it work
> xxx <- ttt[,1:ncol(ttt)]
> xxx <- within(xxx, hello <- 22)
我不知道是什么原因造成的。这就是为什么我无法缩短示例——例如,通过删除列。