如何在 R 中使用散列到散列中

How to use hash into hashes in R

我如何在 R 中使用散列以便键值具有其他散列?

在 python 我会有这样的东西:

hash = {} hash["other_hash"] = {} hash["other_hash"]["value"] = 5

在 R 中,我尝试使用散列库和 env 结构来创建散列,但我无法在其他散列的键值内创建一个散列。

您可以使用 list():

hash <- list(other_hash = list(value = 5))
hash$other_hash$value #5