gpt4 book ai didi

r - R中散列和列表之间的差异

转载 作者:行者123 更新时间:2023-12-04 19:14:50 25 4
gpt4 key购买 nike

在 R 中,我发现列表是有用的结构(就像 Python 中的字典)。我偶然发现了 hash包似乎提供了非常相似的功能。

列表和散列之间是否有任何实际差异使一个比另一个更受欢迎? (除了列表是基础的一部分)

我希望这不是太开放,但不确定如何缩小范围。

最佳答案

来自 hash文档:

PASS-BY REFERENCE. Environments and hashes are special objects in Rbecause only one copy exists globally. When provide as an argument toa function, no local copy is made and any changes to the hash in thefunctions are reflected globally.

PERFORMANCE. Hashes are based onenvironments and are designed to be exceedingly fast using theenvironments internal hash table. For small data structures, a listwill out-perform a hash in nearly every case. For larger datastructure, i.e. >100-1000 key value pair the performance of the hashbecomes faster. Much beyond that the performance of the hash faroutperforms native lists.

关于r - R中散列和列表之间的差异,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10862954/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com