我知道大多数情况下,点对列表不在核心语言之外使用,但我认为出于某种原因,它们在内部而不是通用向量中使用。
为什么在 R 内部使用 pairlists,在你自己的函数中使用 pairlists 有什么性能优势?
最佳答案
回答你的第二个问题,我不这么认为。 Section 2.1.11 R 文档中指出:
Pairlists are handled in the R language in exactly the same way as generic vectors (“lists”). In particular, elements are accessed using the same
[[]]
syntax. The use of pairlists is deprecated since generic vectors are usually more efficient to use. When an internal pairlist is accessed from R it is generally (including when subsetted) converted to a generic vector.
关于r - 何时在 R 中使用配对列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17637128/