Skip to content

Instantly share code, notes, and snippets.

@matt-dray
Created September 29, 2021 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matt-dray/78b6c96eae5a4e6ba1cc186fc0b54612 to your computer and use it in GitHub Desktop.
Save matt-dray/78b6c96eae5a4e6ba1cc186fc0b54612 to your computer and use it in GitHub Desktop.
Find the objects with the longest names from the tidyverse suite of packages for R
library(tidyverse)
library(pacman)
p_load(char = tidyverse_packages())
pkgs <- paste0("package:", tidyverse_packages())
pkgs
# [1] "package:broom" "package:cli" "package:crayon"
# [4] "package:dbplyr" "package:dplyr" "package:dtplyr"
# [7] "package:forcats" "package:googledrive" "package:googlesheets4"
# [10] "package:ggplot2" "package:haven" "package:hms"
# [13] "package:httr" "package:jsonlite" "package:lubridate"
# [16] "package:magrittr" "package:modelr" "package:pillar"
# [19] "package:purrr" "package:readr" "package:readxl"
# [22] "package:reprex" "package:rlang" "package:rstudioapi"
# [25] "package:rvest" "package:stringr" "package:tibble"
# [28] "package:tidyr" "package:xml2" "package:tidyverse"
map(pkgs, ls) %>%
set_names(tidyverse_packages()) %>%
enframe(name = "package", value = "object") %>%
unnest(object) %>%
mutate(nchar = nchar(object)) %>%
arrange(desc(nchar))
# # A tibble: 2,982 × 3
# package object nchar
# <chr> <chr> <int>
# 1 googlesheets4 vec_ptype2.googlesheets4_formula 32
# 2 googlesheets4 vec_cast.googlesheets4_formula 30
# 3 cli cli_progress_builtin_handlers 29
# 4 rstudioapi getRStudioPackageDependencies 29
# 5 rstudioapi launcherPlacementConstraint 27
# 6 cli ansi_has_hyperlink_support 26
# 7 ggplot2 scale_continuous_identity 25
# 8 ggplot2 scale_linetype_continuous 25
# 9 haven vec_arith.haven_labelled 24
# 10 rstudioapi getActiveDocumentContext 24
# … with 2,972 more rows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment