Skip to content
Learn Netverks

Lesson

Step 15/36 42% through track

readr-import

Importing data with readr (local)

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

This lesson

This lesson teaches Importing data with readr (local): the syntax, patterns, and safety habits you need before advancing in R.

Teams still ship Importing data with readr (local) in R codebases—skipping it leaves gaps in debugging and code reviews.

You will apply Importing data with readr (local) 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.

readr reads CSV and friends faster than base read.csv, with better type guessing. Install locally; playground uses base read.csv on built-in or inline data concepts.

readr locally

library(readr)
df <- read_csv("data/scores.csv")

Base R import

# read.csv("file.csv", stringsAsFactors = FALSE)
# For playground: build frames in code or use data() for built-ins

Data hygiene

Validate column types after import—compare with typed ETL in Data Science pipelines pulling from SQL.

Important interview questions and answers

  1. Q: read_csv vs read.csv?
    A: readr is faster, gives tibbles, and parses types with less surprise.
  2. Q: stringsAsFactors in read.csv?
    A: Set FALSE to keep character columns—modern default behavior improved.

Self-check

  1. What base function reads CSV files?
  2. Why validate types after import?

Tip: After CSV import, always check str(df) or summary(df) for type surprises.

Interview prep

read.csv caveat?

Specify stringsAsFactors = FALSE on older examples; validate column types after import.

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

  • read_csv vs read.csv?
  • Locale cols?

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