Last active
August 29, 2022 07:46
-
-
Save favstats/f9a5aaea01d6c3378b1a2160d5c86bd6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
## this r code is taking from here: https://github.com/mkearney/pkguse | |
read_r_files <- function(...) { | |
dirs <- unlist(list(...)) | |
r <- unlist(lapply(dirs, list.files, | |
pattern = "\\.(R|Rmd|Rmarkdown|rmd|r|Rhistory)$", | |
recursive = TRUE, | |
full.names = TRUE, | |
all.files = TRUE)) | |
suppressWarnings( x <- unlist(lapply(r, tfse::readlines))) | |
x | |
} | |
## read in r files | |
rss <- read_r_files(c("C://Users//favoo//Dropbox", "C://Users//favoo//Documents//git_proj")) | |
## parse everything that comes before assignment arrow "<-" | |
df_names <- rss %>% | |
stringr::str_extract("\\w+(?=.*<-)") %>% | |
na.omit() %>% | |
table(df_name = .) %>% | |
as_tibble() | |
## look at most common occuring variable names | |
df_names %>% | |
arrange(-n) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment