-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
242 additions
and
49 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,24 @@ | ||
Package: packagemetrics | ||
Title: What the Package Does (one line, title case) | ||
Version: 0.0.0.9000 | ||
Authors@R: person("First", "Last", email = "[email protected]", role = c("aut", "cre")) | ||
Description: What the package does (one paragraph). | ||
Depends: R (>= 3.4.0) | ||
Imports: | ||
dplyr, | ||
tidyr, | ||
purrr, | ||
stringr, | ||
rvest, | ||
cranlogs, | ||
janitor, | ||
tidyverse, | ||
xml2, | ||
devtools | ||
License: MIT | ||
Encoding: UTF-8 | ||
LazyData: true | ||
RoxygenNote: 6.0.1 | ||
Package: packagemetrics | ||
Title: What the Package Does (one line, title case) | ||
Version: 0.0.0.9000 | ||
Authors@R: person("First", "Last", email = "[email protected]", role = c("aut", "cre")) | ||
Description: What the package does (one paragraph). | ||
Depends: R (>= 3.4.0) | ||
Imports: | ||
dplyr, | ||
tidyr, | ||
purrr, | ||
stringr, | ||
rvest, | ||
cranlogs, | ||
janitor, | ||
tidyverse, | ||
xml2, | ||
devtools, | ||
stackr, | ||
tidytext, | ||
tibble | ||
License: MIT | ||
Encoding: UTF-8 | ||
LazyData: true | ||
RoxygenNote: 6.0.1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(cran_metrics) | ||
export(getGitHub) | ||
export(scrape_github_package_page) | ||
importFrom(dplyr,"%>%") | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(combine_metrics) | ||
export(cran_metrics) | ||
export(getGitHub) | ||
export(get_pkgs) | ||
export(scrape_github_package_page) | ||
export(so_metrics) | ||
importFrom(dplyr,"%>%") |
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
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
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# install.packages("devtools") | ||
devtools::install_github("dgrtwo/stackr") | ||
|
||
library("stackr") | ||
|
||
Sys.setenv(STACK_EXCHANGE_KEY = "5Ib89*ZRQgg2kKogWgS3)g((") | ||
|
||
|
||
## get # hits for a given pkg | ||
hits <- function(pkg, sotag = "r", pagesize = 100, num_pages = 200, ...){ | ||
res <- stack_search(body = pkg, tagged = sotag, pagesize = pagesize, | ||
num_pages = num_pages, ...) | ||
nrow(res) | ||
} | ||
|
||
foobar <- hits(pkg = "trackeR") | ||
foo <- stack_search(body = "trackeR", tagged = "r", pagesize = 100, num_pages = 200) | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
## get questions with [r] tag and "table" in the body | ||
results <- stack_search(tagged = "r", body = "table", filter = "withbody", | ||
pagesize = 100, num_pages = 200) | ||
save(results, file = "results_table.rda") | ||
names(results) | ||
results[1,"body"] | ||
|
||
|
||
library("tidytext") | ||
body <- results[, "body", drop = FALSE] | ||
str(body) | ||
|
||
tidyResults <- body %>% unnest_tokens(output = word, input = body, token = "words") | ||
str(tidyResults) | ||
head(tidyResults, 20) | ||
foo <- tidyResults %>% anti_join(stop_words) | ||
head(foo, 20) ## hu? | ||
|
||
availPkg <- available.packages(repos="https://cran.rstudio.com") | ||
class(availPkg) | ||
|
||
library("tibble") | ||
apkg <- as.tibble(availPkg) | ||
|
||
fooInner <- tidyResults %>% inner_join(select(apkg, Package), by = c("word" = "Package")) | ||
head(fooInner) | ||
fooSemi<- tidyResults %>% semi_join(select(apkg, Package), by = c("word" = "Package")) | ||
head(fooSemi) | ||
|
||
|
||
|
||
###-------------------------------- | ||
## get df with posts with "table" in the title | ||
posts <- stack_search(intitle = "table") | ||
|
||
names(posts) | ||
head(posts) | ||
|
||
## get more info on those questions | ||
|
||
qs <- stack_questions(id = posts$question_id) | ||
|
||
names(qs) | ||
head(qs) | ||
|
||
as <- stack_questions(id = posts$question_id, special = "answers") | ||
|
||
names(as) | ||
head(as) | ||
|
||
##--- |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
Version: 1.0 | ||
|
||
RestoreWorkspace: No | ||
SaveWorkspace: No | ||
AlwaysSaveHistory: Default | ||
|
||
EnableCodeIndexing: Yes | ||
Encoding: UTF-8 | ||
|
||
AutoAppendNewline: Yes | ||
StripTrailingWhitespace: Yes | ||
|
||
BuildType: Package | ||
PackageUseDevtools: Yes | ||
PackageInstallArgs: --no-multiarch --with-keep.source | ||
PackageRoxygenize: rd,collate,namespace | ||
Version: 1.0 | ||
|
||
RestoreWorkspace: No | ||
SaveWorkspace: No | ||
AlwaysSaveHistory: Default | ||
|
||
EnableCodeIndexing: Yes | ||
UseSpacesForTab: Yes | ||
NumSpacesForTab: 2 | ||
Encoding: UTF-8 | ||
|
||
RnwWeave: Sweave | ||
LaTeX: pdfLaTeX | ||
|
||
AutoAppendNewline: Yes | ||
StripTrailingWhitespace: Yes | ||
|
||
BuildType: Package | ||
PackageUseDevtools: Yes | ||
PackageInstallArgs: --no-multiarch --with-keep.source | ||
PackageRoxygenize: rd,collate,namespace |