Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Exercise Creating a named list Well done, you're on a roll! Just like on your to - do list, you want to avoid not knowing
Exercise
Creating a named list
Well done, you're on a roll!
Just like on your todo list, you want to avoid not knowing or remembering what the components of your list stand for. That is why you should give names to them:
This creates a list with components that are named name name and so on If you want to name your lists after you've created them, you can use the names function as you did with vectors. The following commands are fully equivalent to the assignment above:
ist Listompomp
names ist name
Instructions
Change the code of the previous exercise see editor by adding names to the components. Use for myvector the name vec, for mymatrix the name mat and for imydf the name df
Print out mylist so you can inspect the output.
script:R
F Vector with numerics from up to myvector :
# Matrix with numerics from up to
mymatrix matrix ncol
# First elements of the builtin data frame mtcars mydf mtcars
# Adapt list call to give the components names mylist listmyvector, mymatrix, mydf
# Print out mylist
R Console
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started