typestar

readr in R

read_csv is faster than read.csv, and it tells you what it guessed.

library(readr)
library(dplyr)

text <- "day,lang,tpm,note\n2026-07-29,r,96,\n2026-07-30,python,104,fast\n"

runs <- read_csv(text,
                 col_types = cols(
                   day = col_date(format = "%Y-%m-%d"),
                   lang = col_character(),
                   tpm = col_integer(),
                   note = col_character()
                 ),
                 na = c("", "NA"))
print(runs)
print(sapply(runs, class))

path <- tempfile(fileext = ".csv")
write_csv(runs, path)
print(nrow(read_csv(path, show_col_types = FALSE)))

How it works

  1. col_types stops the guessing and documents the schema.
  2. na says which strings mean missing.
  3. problems() reports the rows that did not fit.

Keywords and builtins used here

The run, in numbers

Lines
19
Characters to type
423
Tokens
104
Three-star pace
100 tpm

At the three-star pace of 100 tokens a minute, this run takes about 62 seconds.

Type this snippet

Step 1 of 3 in Reading & selecting, step 9 of 12 in Reshaping & reading.

← Previous Next →