I am new to R programming. After checking some tutorial I picked up most things I needed, but one thing is still missing: the data structure map.
Does everybody know if R has dict? In which I can store (key, value) pairs?
Thanks!!
Since array/vector elements can be named, you get some of the properties of a map/dictionary builtin.
x <- c(apple = 1, banana = 99, "oranges and lemons" = 33)
x["apple"]
x[c("bananas", "oranges and lemons")]
x[x == 99]
(If your values are of different types, then you need to use a list
instead of a vector.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With