typestar

Tibbles in R

A tibble prints tidily, never converts strings, and never partial-matches.

library(dplyr)

runs <- tibble(
  lang = c("r", "python", "r", "sql"),
  tpm = c(88, 104, 96, 79),
  stars = c(2L, 3L, 3L, 1L),
  fast = tpm > 90
)

print(runs)
print(dim(runs))
print(sapply(runs, class))
print(as_tibble(head(mtcars, 2)))

How it works

  1. tibble() builds columns in order, and later ones may use earlier ones.
  2. Printing shows the type under each column name.
  3. as_tibble converts a data frame without changing the data.

Keywords and builtins used here

The run, in numbers

Lines
13
Characters to type
230
Tokens
89
Three-star pace
90 tpm

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

Type this snippet

Step 1 of 4 in Tibbles & columns, step 1 of 27 in dplyr.

Next →