-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
60 lines (43 loc) · 1.89 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
title: "ghstars"
output: github_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(
fig.path = "man/figures/README-",
fig.align = "left",
out.width = "70%",
message = FALSE,
error = FALSE
)
```
## Motivation
Developers love GitHub. Even more so, they love seeing the stars of their repos rise. This is evident in the popularity of website's such [star-history.t9t.io](https://star-history.t9t.io/) which created plots like this one.
<img src="man/figures/ggplot2_star_history.PNG" width="70%"/>
Having a website to create these kind of plots in great but I thought it would be even better to have an `R` package to do so. That's why I created `{ghstars}`.
## Overview
`get_repo_star_history()` is the work horse of `{ghstars}`. It fetches the star history of any GitHub repository via the GitHub API thanks to the `{gh}` package. Its associated plot method creates a stunning visualization of the star history.
```{r}
library(ghstars)
star_history <- get_repo_star_history("thomas-neitmann/ggcharts")
head(star_history)
plot(star_history)
```
`get_pkg_star_history()` is a shortcut for retrieving the star history of `R` packages. It allows you to pass just the package name instead of the whole repo name as its argument. The function searches for the GitHub repo of the package. If it is successful it calls `get_repo_star_history()`. If not, an error is thrown.
```{r}
star_histories <- get_pkg_star_history(c("Rcpp", "scales"))
plot(star_histories)
```
## Installation
The package is currently only available from GitHub.
```r
if (!"remotes" %in% installed.packages()) {
install.packages("remotes")
}
remotes::install_github("thomas-neitmann/ghstars", upgrade = "never")
```
If you get an error when trying to install, run this code and then try to install once again.
```r
Sys.setenv(R_REMOTES_NO_ERRORS_FROM_WARNINGS = "true")
```
If the installation still fails please open an issue.