repmis: Miscellaneous Tools for Reproducible Research

Reproducible researchのためのツール群

> library(repmis)

バージョン: 0.4.4


関数名 概略
InstallOldPackages Install old versions of R packages.
LoadandCite Install, load, and cite R packages
git_stamp Get git stamp (commit and branch) for a repository
scan_https Read a character text file from a secure (https) site into R as a single object.
set_valid_wd Sets valid working directory from vector of possible directories
source_DropboxData Load plain-text data from Dropbox non-Public folders
source_XlsxData Download an Excel data set
source_data Load plain-text data and RData from a URL (either http or https)

InstallOldPackages

以前のバージョンのRパッケージをインストールする

> InstallOldPackages(pkgs, 
+                    versions, 
+                    oldRepos = "http://cran.r-project.org",
+                    lib = NULL)

git_stamp

Gitリポジトリのコミットを返す

> git_stamp(repo = getwd())
                                    commit 
"376daa199f08d0bb2599c726f4da43505ee1845e" 
                                    branch 
                                  "master" 
                                   message 
                                  "change"

source_DropboxData

DropboxにあるPublicでないファイル(.csv, tsv)を読み込む。

Arguments

> source_DropboxData(file = "fin_research_note.csv",
+                    key  = "exh4iobbm2p5p1v",
+                    sep  = ",", header = TRUE) %>% 
+   head()
Downloading data from: https://dl.dropboxusercontent.com/s/exh4iobbm2p5p1v/fin_research_note.csv
SHA-1 hash of the downloaded data file is:
20d03b194b24816f90776dae178e7e8dd5510f41
  idn     country year sr reg_4state ocbu ocbu_lag se_ptrade_i_ocbu
1   1 Afghanistan 1987  0          1    0       NA               NA
2   1 Afghanistan 1988  0          1    0        0               NA
3   1 Afghanistan 1989  0          1    0        0               NA
4   1 Afghanistan 1990  0          1    0        0               NA
5   1 Afghanistan 1991  0          1    0        0               NA
6   1 Afghanistan 1992  0          1    0        0               NA
  se_high_equity_ocbu se_eu_ocbu se_basel_ocbu se_easia_ocbu se_cbss_ocbu
1                  NA          0             0             0            0
2                   0          0             0             0            0
3                   0          0             0             0            0
4                  NA          0             0             0            0
5                  NA          0             0             0            0
6                  NA          0             0             0            0
  cbocb cbocb_lag se_ptrade_i_cbocb se_high_equity_cbocb se_eu_cbocb
1     0        NA                NA                   NA           0
2     0         0                NA            0.2857143           0
3     0         0                NA            0.5714286           0
4     0         0                NA                   NA           0
5     0         0                NA                   NA           0
6     0         0                NA                   NA           0
  se_basel_cbocb se_easia_cbocb se_cbss_cbocb e_asia cbss imf_2
1              0              0             0      0    0     0
2              0              0             0      0    0     0
3              0              0             0      0    0     0
4              0              0             0      0    0     0
5              0              0             0      0    0     0
6              0              0             0      0    0     0
  basel_member gdp_2005_nse log_gdp gdp_change     fdi portfolio_invest
1            0           NA      NA         NA  0.0040                0
2            0           NA      NA         NA      NA                0
3            0           NA      NA         NA      NA                0
4            0           NA      NA         NA      NA               NA
5            0           NA      NA         NA -0.0028               NA
6            0           NA      NA         NA  0.0036               NA
  post_warsaw crisis_base crisis6 checks polar cbg_time_in_office eu
1           0           0       0      1     0                 NA  0
2           0           0       0      1     0                 NA  0
3           0           0       0      1     0                 NA  0
4           0           0       0      1     0                 NA  0
5           0           0       0      1     0                 NA  0
6           0           0       0      1     0                 NA  0
  udems_mean income_diversity asset_diversity dbagdp netintmargin
1 -1.6083570               NA              NA     NA           NA
2 -1.2606440               NA              NA     NA           NA
3 -1.2877780               NA              NA     NA           NA
4 -1.2878620               NA              NA     NA           NA
5 -1.2899180               NA              NA     NA           NA
6 -0.5499151               NA              NA     NA           NA
  concentration inslife insnonlife stmktcap pr_bur pr_corrupt pr_invest
1            NA      NA         NA       NA     NA         NA        NA
2            NA      NA         NA       NA     NA         NA        NA
3            NA      NA         NA       NA     NA         NA        NA
4            NA      NA         NA       NA     NA         NA        NA
5            NA      NA         NA       NA     NA         NA        NA
6            NA      NA         NA       NA     NA         NA        NA
  pr_law_order pr_socio_econ inf_rr crrncy_crisis infltn_crisis
1           NA            NA     NA            NA            NA
2           NA            NA     NA            NA            NA
3           NA            NA     NA            NA            NA
4           NA            NA     NA            NA            NA
5           NA            NA     NA            NA            NA
6           NA            NA     NA            NA            NA
  stck_mrkt_crash inf_imf indp_yr banking_crisis crisis_tally
1              NA      NA      NA             NA           NA
2              NA      NA      NA             NA           NA
3              NA      NA      NA             NA           NA
4              NA      NA      NA             NA           NA
5              NA      NA      NA             NA           NA
6              NA      NA      NA             NA           NA
  gdp_change_maddison _st _d   _t  _t0
1          -0.2083665   1  0 1987    0
2          -0.0905938   1  0 1988 1987
3           0.0060319   1  0 1989 1988
4          -0.0477373   1  0 1990 1989
5           0.0079489   1  0 1991 1990
6           0.0098659   1  0 1992 1991

source_XlsxData

ウェブ上のexcelファイルの読み込み

引数は{xlsx}パッケージのread.xlsxと同様のものが適用可能。

> source_XlsxData(url, 
+                 sheet, 
+                 sha1 = NULL, 
+                 cache = FALSE,
+                 clearCache = FALSE, 
+                 ...)