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
tibble()builds columns in order, and later ones may use earlier ones.- Printing shows the type under each column name.
as_tibbleconverts a data frame without changing the data.
Keywords and builtins used here
as_tibblecdimheadlibraryprintsapplytibble
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.
Step 1 of 4 in Tibbles & columns, step 1 of 27 in dplyr.