Skip to content
Learn Netverks

Lesson

Step 29/36 81% through track

lists-r

Lists

Last reviewed Jun 1, 2026 Content v20260601
Track mode
server_script
Means
Server runner
Reading
~1 min
Level
advanced

This lesson

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

Teams still ship Lists in R codebases—skipping it leaves gaps in debugging and code reviews.

You will apply Lists 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 pointers, structs, and basic control flow from intermediate lessons are familiar.

A list holds heterogeneous objects—vectors, data frames, functions, even nested lists. Lists power JSON-like structures and model objects returned by lm().

Creating lists

item <- list(
  name = "Ada",
  scores = c(90, 92),
  meta = list(source = "exam")
)
print(item$name)
print(length(item))

List vs vector

Vectors are homogeneous atomic sequences; lists are recursive containers—similar to Python lists of mixed types.

Important interview questions and answers

  1. Q: How access list elements?
    A: $name, [["name"]], or [[1]]—double brackets simplify structure.
  2. Q: Why lm returns a list?
    A: Complex results bundle coefficients, residuals, call, etc.

Self-check

  1. What function creates a list?
  2. How extract nested meta$source?

Tip: [[ ]] extracts one element; [ ] may return a sub-list.

Interview prep

List indexing?

[[1]] or $name extracts elements; [ ] may subset.

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

  • list vs vector?
  • lapply intro?

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