0
0
R Programmingprogramming~10 mins

Vector creation with c() 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 vector with numbers 1, 2, and 3.

R Programming
vec <- [1](1, 2, 3)
Drag options to blanks, or click blank then click option'
Aseq
Bvector
Clist
Dc
Attempts:
3 left
💡 Hint
Common Mistakes
Using list() instead of c()
Using vector() without specifying type
2fill in blank
medium

Complete the code to create a character vector with elements "apple", "banana", and "cherry".

R Programming
fruits <- [1]("apple", "banana", "cherry")
Drag options to blanks, or click blank then click option'
Ac
Blist
Cvector
Dseq
Attempts:
3 left
💡 Hint
Common Mistakes
Using list() which creates a list, not a vector
3fill in blank
hard

Fix the error in the code to create a numeric vector with 4, 5, and 6.

R Programming
numbers <- [1](4, 5, 6)
Drag options to blanks, or click blank then click option'
Alist
Bvector
Cc
Dseq
Attempts:
3 left
💡 Hint
Common Mistakes
Using list() which creates a list, not a vector
4fill in blank
hard

Fill both blanks to create a vector of logical values TRUE and FALSE.

R Programming
logical_vec <- [1](TRUE, [2])
Drag options to blanks, or click blank then click option'
Ac
BFALSE
CTRUE
Dlist
Attempts:
3 left
💡 Hint
Common Mistakes
Using list() instead of c()
Using TRUE twice
5fill in blank
hard

Fill all three blanks to create a vector with elements 10, 20, and 30.

R Programming
vec <- [1]([2], [3], 30)
Drag options to blanks, or click blank then click option'
Ac
B10
C20
Dlist
Attempts:
3 left
💡 Hint
Common Mistakes
Using list() instead of c()
Swapping the order of numbers