typestar

Looking at a table in R

glimpse, skim-style summaries, and counting missing values per column.

library(dplyr)

runs <- tibble(
  lang = c("r", "python", NA),
  tpm = c(96, NA, 104),
  stars = c(3L, 3L, 2L)
)

glimpse(runs)

missing <- runs |>
  summarise(across(everything(), ~ sum(is.na(.x)))) |>
  tidyr::pivot_longer(everything(), names_to = "column",
                      values_to = "missing") |>
  arrange(desc(missing))
print(missing)
print(summary(runs$tpm))

How it works

  1. glimpse prints one row per column, so wide tables fit.
  2. summarize(across(...)) builds a missingness report.
  3. arrange on that report puts the worst columns first.

Keywords and builtins used here

The run, in numbers

Lines
17
Characters to type
338
Tokens
109
Three-star pace
100 tpm

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

Type this snippet

Step 2 of 2 in Ending a pipeline, step 26 of 27 in dplyr.

← Previous Next →