Lists are versatile data structures that can contain elements of different types like numbers, strings, vectors, or even other lists. They are created using the list()
# Given list
y <- list("a", "b", "c")
# Assigning new names to the elements of y
names(y) <- c("one", "two", "three")
# Displaying the updated list y with new names
print(y)
Splitting the string into two parts based on the space character using strsplit(string, " ")
# Given string
string <- "Grand Opening"
# Splitting the string into two parts based on the space character
split_string <- strsplit(string, " ")[[1]]
# Displaying the output
for (part in split_string) {
print(part)
}