I am working on map data structure in which i need to store key value pair.
map[key1]<-value1
map[key2]<-value2
map[key3]<-value3
map[key4]<-value4
I need to get value based on key. How can i implement this in R?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use a list, because a simple vector constructed with
ccan’t handle anything more than scalar values:why does this fail? because
mapis now:use a
listinstead:also dynamically extensible:
Start with an empty
map=list()if you are building one up.