| Type: | Package |
| Title: | Learning R with Dr. Hu |
| Version: | 2.0.0 |
| Description: | Provides interactive workshops for learning R easily and happily. Each workshop is a self-contained 'Quarto' Live document whose code cells run in the browser via 'WebAssembly', so learners can read the instructions and run the exercises side by side without a local R setup. The materials accompany the "Learning R with Dr. Hu" workshop series. |
| License: | MIT + file LICENSE |
| VignetteBuilder: | knitr |
| Encoding: | UTF-8 |
| URL: | https://www.drhuyue.site/drhur/, https://github.com/sammo3182/drhur |
| BugReports: | https://github.com/sammo3182/drhur/issues |
| LazyData: | true |
| SystemRequirements: | Quarto command-line tool (https://quarto.org) |
| Depends: | R(≥ 3.6.0) |
| Imports: | quarto |
| Suggests: | servr, rmarkdown, scales, modelsummary, knitr, tidyverse |
| Config/roxygen2/version: | 8.0.0 |
| NeedsCompilation: | no |
| Packaged: | 2026-05-30 05:35:10 UTC; yuehu |
| Author: | Yue Hu [aut, cre], Qian Qiu [ctb, trl], Xinyi Ye [ctb, trl], Yufei Sun [ctb] |
| Maintainer: | Yue Hu <yuehu@tsinghua.edu.cn> |
| Repository: | CRAN |
| Date/Publication: | 2026-05-30 05:50:02 UTC |
Calling for a Workshop in Dr Hu's R Workshop
Description
The function renders a self-contained Quarto Live
document from the workshop materials shipped with the package and opens it in
the browser. Each workshop is an interactive document whose code cells run in
the browser via WebAssembly (webR); no local R session is required to
run the exercises. The workshop list is continually updated along with the R
workshop with Dr. Hu.
Usage
drhur(
workshop,
lang = "cn",
style = "document",
output_dir = tempdir(),
quiet = FALSE
)
Arguments
workshop |
A character string naming the workshop to open. See details for the available workshops. |
lang |
A character string giving the display language: simplified
Chinese ( |
style |
A character string choosing the output style: |
output_dir |
Directory in which the workshop is rendered. Defaults to a per-session temporary directory. The installed package files are never modified. |
quiet |
Logical; suppress Quarto's rendering output. Defaults to
|
Details
The workshops available in the current version (Basics series):
-
algebra: Basic maths, vectors, and matrices with R syntax. -
play: Basic data structures; inputting, outputting, and creating data. -
munging: Generalizing and extracting data frames (sorting, summarizing, selecting, mutating). -
descriptive: Describing variables and data, including summary tables and distribution plots. -
visual_basic: Presenting variables, patterns, and estimates with visualization tools. -
loop: Conditionals, loops, and batch processing.
Every workshop ships in two language editions, selected with lang:
simplified Chinese ("cn", the default) and English ("en").
Rendering requires the Quarto command-line tool to
be installed. Running the interactive code cells in the rendered document
additionally requires an internet connection, because the webR runtime
and the workshop's R packages are downloaded in the browser at view time.
Because Quarto Live cells run on OJS and webR, which browsers disable
for documents opened directly from disk (file://), the workshop is
served over a local web server rather than opened as a file. This serving
step uses the servr package, a suggested dependency; install it with
install.packages("servr") if prompted. In an interactive session the
server is started in the background (so your R console stays free) and
remains available for the rest of the session; stop it with
servr::daemon_stop().
Value
(Invisibly) the path to the rendered HTML file.
Examples
## Not run:
# Open the algebra workshop as an HTML live document (Chinese, the default)
drhur("algebra")
# Open the same workshop in English
drhur("algebra", lang = "en")
# Open the data-munging workshop as a slide deck
drhur("munging", style = "slide")
## End(Not run)
A Random Sample of World Value Survey (Wave 7).
Description
A dataset randomly sampled from the 7th wave of World Value Survey released in 2022.
Usage
wvs7
Format
A data frame with 1330 rows and 24 variables:
countryThe country the interview was made.
femaleRespondent’s sex is female.
ageRespondent's age.
educationThe highest education that the respondent had attained.
religiousIndependently of whether the respondent attend religious services or not, did the respondent identify him/herself as a religious person, not a religious person, or an atheist?
maritalMarital status of the respondent.
incomeLevelThe income group the respondent believes his/her household belonged.
equalIncentiveRespondent's view between "Incomes should be made more equal" and "There should be greater incentives for individual effort".
equalFreedomMost people consider both freedom and equality to be important, but if one had to choose between them, which one would the respondent consider more important?
corruption_stateHow many state authorities did the respondent believe were involved in corruption.
corruption_localHow many local authorities did the respondent believe were involved in corruption.
corruption_civilHow many civil service providers did the respondent believe were involved in corruption.
trust_familyRespondent's trust of his/her family.
trust_neighborRespondent's trust of his/her neighborhood.
trust_strangerRespondent's trust of people s/he meet for the first time.
trust_foreignerRespondent's trust of people of another nationality.
confidence_armedForceRespondent's confidence in the armed forces.
confidence_policyRespondent's confidence in the armed forces.
confidence_courtRespondent's confidence in the courts.
confidence_govRespondent's confidence in the government.
confidence_parliamentRespondent's confidence in the paliament.
confidence_civilRespondent's confidence in the civil service.
confidence_partiesRespondent's confidence in the political parties.
confidence_tvRespondent's confidence in the television.
Source
https://www.worldvaluessurvey.org/WVSDocumentationWV7.jsp
References
Haerpfer, C., Inglehart, R., Moreno, A., Welzel, C., Kizilova, K., Diez-Medrano J., M. Lagos, P. Norris, E. Ponarin & B. Puranen et al. (eds.). 2020. World Values Survey: Round Seven – Country-Pooled Datafile. Madrid, Spain & Vienna, Austria: JD Systems Institute & WVSA Secretariat. doi.org/10.14281/18241.1