0
0
R Programmingprogramming~10 mins

NULL and NA values 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 assign a missing value in R.

R Programming
x <- [1]
Drag options to blanks, or click blank then click option'
ANA
BNULL
C0
DFALSE
Attempts:
3 left
💡 Hint
Common Mistakes
Using NULL instead of NA for missing data.
2fill in blank
medium

Complete the code to check if a value is NA.

R Programming
is.na([1])
Drag options to blanks, or click blank then click option'
ANULL
Bx
CFALSE
DNA
Attempts:
3 left
💡 Hint
Common Mistakes
Checking is.na(NA) directly instead of a variable.
3fill in blank
hard

Fix the error in the code to remove NULL values from a vector.

R Programming
clean_vec <- vec[!is.null([1])]
Drag options to blanks, or click blank then click option'
Avec
Bclean_vec
CNULL
DNA
Attempts:
3 left
💡 Hint
Common Mistakes
Using is.null() to filter vector elements, which does not work element-wise.
4fill in blank
hard

Fill both blanks to create a vector without NA values.

R Programming
clean_vec <- vec[![1]([2])]
Drag options to blanks, or click blank then click option'
Ais.na
Bvec
Cis.null
DNA
Attempts:
3 left
💡 Hint
Common Mistakes
Using is.null instead of is.na to check missing values.
5fill in blank
hard

Fill both blanks to replace NA values with zero in a vector.

R Programming
vec[[1](vec)] <- [2]
vec
Drag options to blanks, or click blank then click option'
Ais.na
B0
CNA
Dis.null
Attempts:
3 left
💡 Hint
Common Mistakes
Using is.null instead of is.na to find missing values.