-
-
Save katerinaalex/fcc1ecc8d4928d455cbf74ebda189533 to your computer and use it in GitHub Desktop.
This file contains hidden or 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