how to add in R dictionary

# Step 1: Create an empty dictionary
my_dict <- list()

# Step 2: Add key-value pairs to the dictionary
my_dict[["key1"]] <- "value1"
my_dict[["key2"]] <- 123
my_dict[["key3"]] <- c(1, 2, 3)

# Step 3: Display the dictionary
print(my_dict)

Note: In R, dictionaries are implemented using lists. In this example, we create an empty list (my_dict) and then add key-value pairs to it using double square brackets ([[]]). The keys can be any valid R objects, and the values can be of different types such as characters, numeric, or vectors. The print function is used to display the contents of the dictionary.