0
0
R Programmingprogramming~10 mins

Named list elements in R Programming - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a named list with elements 'a' and 'b'.

R Programming
my_list <- list([1] = 1, b = 2)
Drag options to blanks, or click blank then click option'
Ax
B1
Cc
Da
Attempts:
3 left
💡 Hint
Common Mistakes
Using a value instead of a name for the list element.
Using an incorrect name like 'c' or 'x'.
2fill in blank
medium

Complete the code to access the element named 'score' from the list.

R Programming
value <- my_list$[1]
Drag options to blanks, or click blank then click option'
Ascore
B1
Ca
Db
Attempts:
3 left
💡 Hint
Common Mistakes
Using numeric indices instead of names.
Using quotes inside the $ operator.
3fill in blank
hard

Fix the error in naming the list element correctly.

R Programming
my_list <- list([1] = 10, b = 20)
Drag options to blanks, or click blank then click option'
Aa
B1
Cscore
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Using a number as a name.
Confusing element names with values.
4fill in blank
hard

Fill both blanks to create a named list with elements 'name' and 'age'.

R Programming
person <- list([1] = "Alice", [2] = 30)
Drag options to blanks, or click blank then click option'
Aname
Bage
Cgender
Dheight
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect names like 'gender' or 'height'.
Swapping the order of names and values.
5fill in blank
hard

Fill all three blanks to create a named list with elements 'x', 'y', and 'z'.

R Programming
coords <- list([1] = 10, [2] = 20, [3] = 30)
Drag options to blanks, or click blank then click option'
Ax
By
Cz
Dw
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong name like 'w'.
Mixing up the order of names.