I'd like to use blank
on a tail
like I do on a data frame. Is that possible? If not what's more efficient way to get the tail of a data table?
data.table
output
mainDF= data.frame(name= c("a","b","c","d"))
tail(mainDF,1)["name"]
dt<-as.data.table(mainDF)
setkey(dt, name )
tail(dt,1)["name"]
答案 0 :(得分:0)
请查看AnyPic,尤其是 data.table 简介简介,其中介绍了如何以data.table的方式对列进行子集化,以及它背后的基本原理。 / p>
答案是使用tail(dt, 1L)[, "name", with=FALSE]
,正如@thelatemail在评论中指出的那样。
typedef std::unordered_map<std::vector<int>, ObjectPointer, boost::hash<std::vector<int>> Map;
size_t hash_value(const std::vector<int>& vec)
{
std::size_t seed = 0;
for (const auto& val : vec) {
boost::hash_combine(seed, val);
}
return seed;
}