如何在R中使用hash来使键值具有其他哈希值?
在python中我会有这样的东西:
template<typename InputIterator>
InputIterator unserialize(InputIterator begin, InputIterator end) {
auto range = Range<InputIterator>{begin, end};
auto [begin, end] = range.splitSubRange(sizeof(header_type));
//before having "used" the iterator obtained from range, you shouldn't use range again.
std::copy(begin, end, header.begin());
//after having "used" the iterator, you can use the range object to obtain the next sub-range
auto [begin2, dummy] = range.splitSubRange(sizeof(header_type_2));
std::copy_n(begin2, sizeof(header_type_2), header2.begin());
...
return range.begin;
}
在R中我试图使用哈希库和env结构来创建哈希,但是我不能在其他哈希的键值中创建一个哈希。
答案 0 :(得分:1)
您可以使用list()
:
hash <- list(other_hash = list(value = 5))
hash$other_hash$value #5