Question

Write the code to return the output: Code: mylist <- list(c(2020,2021),c("Jan", "Feb"), c("Mon", "Thurs")) Output must...

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"

Homework Answers

Answer #1

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

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write the code to return the output: Code: id <- c(5, 6, 7, 8, 9) prod...
Write the code to return the output: Code: id <- c(5, 6, 7, 8, 9) prod <- c("F", "H", "B", "S", "D") units <- c(12, 19, 44,26, 43) df <- data.frame(id, prod, units) Output must be: [1] 12 19 44 26 43
Year Month Return Year Month Return 2006     Jan 3.95 2008     Jul 3.29 2006     Feb 3.77 2008...
Year Month Return Year Month Return 2006     Jan 3.95 2008     Jul 3.29 2006     Feb 3.77 2008     Aug 4.62 2006     Mar 5.29 2008     Sep 4.81 2006     Apr 3.77 2008     Oct 5.16 2006     May 4.47 2008     Nov 3.69 2006     Jun 5.2 2008     Dec 5.15 2006     Jul 3.9 2009     Jan 5.29 2006     Aug 4.33 2009     Feb 3.19 2006     Sep 4.41 2009     Mar 3.89 2006     Oct 5.14 2009     Apr 4.48 2006     Nov 3.24 2009     May 5.27 2006     Dec 4.13 2009     Jun 3.93 2007     Jan...
Write a SQL code that finds how many days away from thanksgiving. The code should work...
Write a SQL code that finds how many days away from thanksgiving. The code should work in any month in this year 2020. write a code to find the oldest person from a table has an age column. NOTE: please use ssms to write the code with a screenshot of the output.
How do I get this portion of my List Iterator code to work? This is a...
How do I get this portion of my List Iterator code to work? This is a portion of the code in the AddressBookApp that I need to work. Currently it stops at Person not found and if it makes it to the else it gives me this Exception in thread "main" java.lang.NullPointerException    at AddressBookApp.main(AddressBookApp.java:36) iter.reset(); Person findPerson = iter.findLastname("Duck"); if (findPerson == null) System.out.println("Person not found."); else findPerson.displayEntry(); findPerson = iter.findLastname("Duck"); if (findPerson == null) { System.out.println("Person not found.");...
1. Please write the following in C++ also please show all output code and comment on...
1. Please write the following in C++ also please show all output code and comment on code. 2. Also, use CPPUnitLite to write all test and show outputs for each test. Write CppUnitLite tests to verify correct behavior for all the exercises. The modifications are aimed at making the exercises more conducive to unit tests. Write a function that swaps (exchanges the values of two integers). Use int* as the argument type. Write a second swap function using a reference...
The sales budget is provided below for the product of Company ABC. Jan 30,000 units Feb...
The sales budget is provided below for the product of Company ABC. Jan 30,000 units Feb 20,000 units Mar 10,000 units Apr 20,000 units May 30,000 units Finished goods at the end of each month must be 10% of the next month’s budgeted sales. On Dec 31 of the last year, the finished goods totaled 2,000 units. The selling price is $1 per unit. 80% of the credit sales are collected in the month of sale, 15% in the month...
Please read the requirements: Write a C++ function, date, that will accept a date via a...
Please read the requirements: Write a C++ function, date, that will accept a date via a parameter in the month-day-year format, mmddyyyy, (e.g., 10262020 stands for the date October 26, 2020), and then will determine the corresponding month number, day, and year of that date, returning these three integer values to the calling function via arguments. An example of a call to the function date is shown in the following statement: date (10262020, month, day, year); This call to the...
**C code only In this part, you will write a simple user-defined function that prints a...
**C code only In this part, you will write a simple user-defined function that prints a message. This function does not require any parameters or return value. The purpose is simply to get you started writing functions.Open repl project Lab: User-Defined Functions 1. Write a program that calls a function. This function should do the following: 1.Ask the user their name 2. Print a "hello" message that includes the user's name Example output: Please enter your name: ​Mat Hello, Mat!...
1. Write a statement that assigns an empty list to the variable named empty. 2. Write...
1. Write a statement that assigns an empty list to the variable named empty. 2. Write a statement which assigns all the odd integer values between 0 and 10 (in order) to the variable named odds. 3. Write a statement which assigns the list of three-letter abbreviations of the months of the year to the variable months. That would be: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Capitalize correctly and have no punctuation. 4. Create...
ALL CODE MUST BE IN C++ Before you begin, you must write yourself a LinkedList class...
ALL CODE MUST BE IN C++ Before you begin, you must write yourself a LinkedList class and a Node class (please name your classes exactly ​as I did here). Please follow the below specifications for the two classes. Node.cpp ● This must be a generic class. ● Should contain a generic member variable that holds the nodes value. ● Should contain a next and prev Node* as denoted here. ● All member variables should be private. ● Use public and...