cran-task-views / Econometrics

CRAN Task View: Econometrics
https://CRAN.R-project.org/view=Econometrics
30 stars 4 forks source link

Recommend `ctv::install.views(...)` at the top of the page #3

Closed grantmcdermott closed 2 years ago

grantmcdermott commented 2 years ago

(I'm going to start breaking things into separate issues rather than simply continuing in #1, which is getting a bit hard to follow.)

I know that the "main" TaskView page has a suggestion to install the ctv package. But my sense is that surprisingly few people navigate there outside of the specific TV they are looking at. I know that I certainly didn't when I first started using R. As a result, I think each individual TV page should have this suggestion right at the top. For econometrics, I'd go so far as to say we might explicitly encourage users to install the core libraries out of the gate. Something like:

For convenience, we recommend that users getting started with econometrics in R run the following code block. This will install a core set of packages—identified among those discussed below—which should cover all of the primary functionality required by the typical econometrician.

install.packages("ctv")
ctv::install.views("Econometrics", coreOnly = TRUE)

(Even better if there is a convenient way to hyperlink to the core packages as a separate section, or least say how many there are.)

zeileis commented 2 years ago

I will discuss this with the CTV Editors and the CRAN team. We should probably add this automatically to all task views so that it doesn't need to be included in every .md file.

grantmcdermott commented 2 years ago

Great. For me, this is the (secret) killer feature of TaskViews. Just being able to pull in everything I probably need with a single command thanks to a curated list.

zeileis commented 2 years ago

Agreed. For me this was the main motivation to write the ctv package in the first place.

tappek commented 2 years ago

+1. Did not know about this.

zeileis commented 2 years ago

I have added this now to the ctv package. It's currently only in the R-Forge version but I'll release it to CRAN soon (hopefully next week). The header of the CRAN HTML page then contains the following information.


CRAN Task View: Econometrics

Maintainer:Achim Zeileis, Grant McDermott, Kevin Tappe
Contact:Achim.Zeileis at R-project.org
Version:2022-01-22
URL:https://CRAN.R-project.org/view=Econometrics
Source:https://github.com/cran-task-views/Econometrics/
Citation:Achim Zeileis, Grant McDermott, Kevin Tappe (2022). CRAN Task View: Econometrics. Version 2022-01-22. URL https://CRAN.R-project.org/view=Econometrics.
Installation:The packages from this task view can be installed automatically using the ctv package. For example, ctv::install.packages("Econometrics", coreOnly = TRUE) installs all the core packages or ctv::update.packages("Econometrics") installs all packages that are not yet installed and up-to-date. See the CRAN Task View Initiative for more details.
grantmcdermott commented 2 years ago

Looks great, thanks @zeileis.

grantmcdermott commented 2 years ago

A follow-up question: Is there a way to view the list of install-able packages without downloading them? It's not clear to me from the ctv documentation, but I could be missing something...

grantmcdermott commented 2 years ago

Just to clarify @zeileis, I mean something like:

ctv::install.views("Econometrics", coreOnly = TRUE, download = FALSE)

(Or maybe viewOnly = TRUE?)

The idea being that this would print a list of the 11 or 12 core packages, so that users could see them before going ahead with the actual install. (Would also be useful for my teaching notes, so I can easily show students what's going to be installed ;-) )

zeileis commented 2 years ago

The design of install.views() is that it downloads the "ctv" objects currently on CRAN, extracts the corresponding package list, and then calls install.packages(). Hence I wouldn't want to add further functionality there for querying information about the task view.

For querying the information about available views and their contents, one should use available.views():

a <- ctv::available.views()
a
## CRAN Task Views
## ---------------
## Name: Bayesian
## Topic: Bayesian Inference
## Maintainer: Jong Hee Park
## Repository: https://CRAN.R-project.org/
## ---------------
## Name: ChemPhys
## Topic: Chemometrics and Computational Physics
## ...

The print() method should probably be compactified. Will think about something for the next revision.

Then you can extract the individual views:

a$Econometrics
## CRAN Task View
## --------------
## Name:       Econometrics
## Topic:      Econometrics
## Maintainer: Achim Zeileis, Grant McDermott
## Contact:    Achim.Zeileis@R-project.org
## Version:    2022-01-20
## Repository: https://CRAN.R-project.org/
## Packages:   AER*, alpaca, aod, apollo, apt, bayesm, betareg, bife, bimets, BMA,
##             BMS, boot, bootstrap, brglm, CADFtest, car*, CDNmoney, censReg,
##             clubSandwich, clusterSEs, collapse, crch, decompr, dlsem, durmod,
##             dynlm, Ecdat, effects, erer, estimatr, expsmooth, ExtremeBounds,
##             feisr, fixest, fma, forecast*, frm, frontier, fxregime, gam,
##             gamlss, geepack, gets, glmx, gmm, gmnl, gravity, gvc, Hmisc, ineq,
##             ivfixed, ivpack, ivpanel, ivprobit, ivreg, LARF, lavaan, lfe,
##             LinRegInteractive, lme4, lmtest*, lpirfs, margins, MASS,
##             matchingMarkets, Matrix, Mcomp, meboot, mfx, mgcv, mhurdle,
##             micEcon, micEconAids, micEconCES, micEconSNQP, midasr, mlogit, MNP,
##             multiwayvcov, nlme, nnet, NNS, nonnest2, np, nse, ordinal,
##             OrthoPanels, pampe, Paneldata, panelvar, pco, pcse, pdR, pdynmc,
##             pglm, plm*, pscl, psidR, pwt, pwt8, pwt9, quantreg, Rchoice, rdd,
##             rdlocrand, rdmulti, rdpower, rdrobust, reldist, REndo, rms, RSGHB,
##             sampleSelection, sandwich*, segmented, sem, semsfa, sfa,
##             simpleboot, SparseM, spatialprobit, spatialreg, sphet, ssfa,
##             ssmrob, strucchange, survival, systemfit, truncreg, tsDyn,
##             tseries*, urca*, vars, VGAM, wahc, wbstats, wooldridge, xts, zoo*,
##             zTree
##             (* = core package)

Note that this is still generated from the old XML-based file. We will switch in about 12 hours to the new Markdown-based workflow. Some things will look a bit different then and the newer .md file will be used for our task view.

Finally, you can extract the different elements like the package list:

head(a$Econometrics$packagelist)
##     name  core
## 1    AER  TRUE
## 2 alpaca FALSE
## 3    aod FALSE
## 4 apollo FALSE
## 5    apt FALSE
## 6 bayesm FALSE