Skip to content
Learn Netverks

Lesson

Step 17/36 47% through track

missing-data-r

Missing data

Last reviewed May 28, 2026 Content v20260528
Track mode
server_script
Means
Server runner
Reading
~1 min
Level
intermediate

This lesson

This lesson teaches Missing data: the syntax, patterns, and safety habits you need before advancing in R.

NA propagates differently from NULL—na.rm and complete.cases appear in every real dataset.

You will apply Missing data in contexts like: Research pipelines, Shiny dashboards, and statistical reporting.

Write R in the editor and click Run on server—the dev runner executes with Rscript; use print() or cat() and base R in playground snippets (tidyverse locally; LEARNING_RUNNER_ENABLED=true).

When you can explain the previous lesson's ideas without copying starter code.

R represents missing values with NA—propagate through calculations unless handled. Use is.na(), na.omit(), and explicit imputation strategies.

NA behavior

x <- c(10, NA, 30)
print(mean(x))
print(mean(x, na.rm = TRUE))
print(is.na(x))

Handling strategies

  • Remove: na.omit(df) or complete.cases()
  • Impute: mean/median/model-based (document choices in reports)
  • Flag: keep NA and let models handle with na.action

Important interview questions and answers

  1. Q: NA vs NULL?
    A: NA is a missing value placeholder in atomic vectors; NULL means absence of an object.
  2. Q: Why na.rm = TRUE?
    A: Many summary functions return NA if any input is NA unless you opt to remove them.

Self-check

  1. What does mean(c(1, NA, 3)) return without na.rm?
  2. What function tests for NA?

Tip: NA == NA is NA—always use is.na() for tests.

Interview prep

NA propagation?

Most ops return NA if any input is NA unless na.rm = TRUE or explicit handling.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs on the configured server runner (dev: npm run runner with LEARNING_RUNNER_ENABLED=true). Output appears below the editor.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • NA vs NaN?
  • complete.cases?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump