Skip to content
Prev 166813 / 398502 Next

Extracting Hash via Vector

Dear all,

Suppose I have a hash created with this

 x <- list()
for (i in c('test', 'some', 'more')){
   x[[i]] <- runif(1)
}

then I want to extract the elem of that hash with
a vector
But why this failed?
Error in x[[q]] : subscript out of bounds

we expect the output of 'extracted' to be
a vector as well. When the key is not present
to give "NA" in vector

- Gundala Viswanath
Jakarta - Indonesia