1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

パッケージの利用状況を分析する "cranlogs" Package の紹介

Last updated at Posted at 2019-04-08

元ネタ記事

久しぶりにR-Bloggersの最新記事を見ていたらキャッチーなタイトル記事が挙がっていたので記載されていたコードを眺めてみました。

機能としては、目立ったものはないですが、ダウンロード数の期間の設定とかが容易にできるし、コードが直感的に触れる感じが良さそう。

Everyone that authors an R package is curious about how many users download it. As far as I know there’s still no way to get information on all the downloads, from all the R mirrors. Here I’m using package cranlogs, which only gives information on the downloads from the R Studio mirror. It also does not allow to now from where in the world these downloads were made. However, it has a major advantage: speed! The package cranlogs provides a easy (and way faster) method to get this information without having to download all the log files (which can take a long time).

要約すると通常ならログファイルをダウンロードして情報を入手するしかないところを、RStudio Mirrorを通してめちゃ早く簡単にデータにアクセスできるようにしたパッケージです。

...という感じぽいです。

分析準備

# install.packages("cranlogs") #初めて使う人はインストールが必要
library(cranlogs)
library(ggplot2) #可視化に使用
library(tidyverse)

今回は自分が開発・メンテしているパッケージのダウンロード数を分析してみます。

分析開始

FlickrAPI_downloads <- cran_downloads(packages="FlickrAPI", from = "2019-01-01", to = Sys.Date()-1) #期間は今年の初めから
head(FlickrAPI_downloads)
         date count   package
68 2019-01-01     0 FlickrAPI
69 2019-01-02     0 FlickrAPI
70 2019-01-03     0 FlickrAPI
71 2019-01-04     0 FlickrAPI
72 2019-01-05     0 FlickrAPI
73 2019-01-06     0 FlickrAPI

可視化

FlickrAPI_downloads %>% 
  ggplot(aes(date, count)) + 
  geom_line(colour = "red",size=1) + 
  labs(title = paste0("FlickrAPI daily downloads ", Sys.Date()-1), 
       x = "Time",
       y = "No. of downloads")

image.png

ダウンロード数がもっとも多かった10日を表示

FlickrAPI_downloads %>% 
  arrange(desc(count)) %>% 
  head(10)
         date count   package
1  2019-01-31    94 FlickrAPI
2  2019-01-30    67 FlickrAPI
3  2019-04-02    24 FlickrAPI
4  2019-03-27    18 FlickrAPI
5  2019-03-08    17 FlickrAPI
6  2019-03-28    17 FlickrAPI
7  2019-02-12    16 FlickrAPI
8  2019-02-04    15 FlickrAPI
9  2019-02-20    14 FlickrAPI
10 2019-02-25    14 FlickrAPI

リリース直後のダウンロード数が94と67でもっとも多かったみたいです。

その次の4月2日には下記のツイートでステッカーを貼ったタイミングのようです。

1日平均ダウンロード数

mean(FlickrAPI_downloads$count, na.rm = TRUE)
[1] 7.979381

まとめ

直感的に触れるパッケージなので参考になりましたし、毎日平均では約8ダウンロードもされているみたいなので今後とも頑張ってアップデートしていきます。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?