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
- Q: read_csv vs read.csv?
A: readr is faster, gives tibbles, and parses types with less surprise. - Q: stringsAsFactors in read.csv?
A: Set FALSE to keep character columns—modern default behavior improved.
Self-check
- What base function reads CSV files?
- 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 = FALSEon older examples; validate column types after import.