(DF <- aggregate(mpg~as.character(carb), mtcars, mean))
new.hash <- hash(DF) #numeric outcome
sapply(as.character(mtcars$carb), function(x) {
if(exists(x, envir = new.hash)) {
get(x, envir = new.hash)
} else {
NA
}
})
new.hash <- hash(DF, "character") #character outcome
sapply(as.character(mtcars$carb), function(x) {
if(exists(x, envir = new.hash)) {
get(x, envir = new.hash)
} else {
NA
}
})
Run the code above in your browser using DataLab