Write the code to return the output: Code: mylist <- list(c(2020,2021),c("Jan", "Feb"), c("Mon", "Thurs"))
Output must be:
$Year
[1] 2020 2021
$Month
[1] "Jan" "Feb"
$Day [1] "Mon" "Thurs"
Lists are the R objects which contain elements of different types like for example --> numbers, strings, vectors and another list inside it.
################### CODE BELOW #################
#list assigning value
my_list <- list(c(2020,2021),c("Jan", "Feb"), c("Mon",
"Thurs"))
# Give names to elements
names(my_list) <- c("Year", "Month", "Day")
#printing the list
print(my_list)
################ CODE END ####################
Code Output shows below
Get Answers For Free
Most questions answered within 1 hours.