├── publish.yml ├── .Rbuildignore ├── styles.css ├── images ├── console.jpg ├── quarto.jpg ├── install_r.jpg ├── projects.jpg ├── rfun_logo.png ├── tidy_data.png ├── data_import.jpg ├── join_diagram.png ├── packages_run.jpg ├── github_download.jpg ├── packages_load.jpg ├── quarto_project.jpg ├── data_import_code.jpg ├── install_packages.jpg ├── package_tidyverse.jpg ├── gganmimate_example.gif ├── new_quarto_document.jpg ├── visualization-themes.png ├── prefers_global_options.jpg ├── DALL-E_2023-07-13_learn_R.png ├── prefers_global_options_pipe.jpg ├── prefers_global_options_general.jpg ├── DALL-E_2023-07-12_learn_R-coding.png ├── DALL-E_2023-07-13_learn_R_orignal.png └── Little_reproducibility_project_pyramid.jpg ├── data ├── Employee_Sample_Data.csv ├── student_satisfaction_test-data_from_qualtrics.sav ├── 538_favorability_popularity.csv └── brodhead_center.csv ├── .gitignore ├── _publish.yml ├── _freeze ├── viz │ └── figure-html │ │ ├── plot-sleep-labs-1.png │ │ ├── unnamed-chunk-10-1.png │ │ ├── unnamed-chunk-11-1.png │ │ ├── unnamed-chunk-12-1.png │ │ ├── unnamed-chunk-13-1.png │ │ ├── unnamed-chunk-14-1.png │ │ ├── unnamed-chunk-15-1.png │ │ ├── unnamed-chunk-16-1.png │ │ ├── unnamed-chunk-17-1.png │ │ ├── unnamed-chunk-18-1.png │ │ ├── unnamed-chunk-19-1.png │ │ ├── unnamed-chunk-2-1.png │ │ ├── unnamed-chunk-20-1.png │ │ ├── unnamed-chunk-21-1.png │ │ ├── unnamed-chunk-22-1.png │ │ ├── unnamed-chunk-23-1.png │ │ ├── unnamed-chunk-24-1.png │ │ ├── unnamed-chunk-25-1.png │ │ ├── unnamed-chunk-27-1.png │ │ ├── unnamed-chunk-28-1.png │ │ ├── unnamed-chunk-29-1.png │ │ ├── unnamed-chunk-30-1.png │ │ ├── unnamed-chunk-4-1.png │ │ ├── unnamed-chunk-5-1.png │ │ ├── unnamed-chunk-6-1.png │ │ ├── unnamed-chunk-7-1.png │ │ ├── unnamed-chunk-8-1.png │ │ ├── unnamed-chunk-9-1.png │ │ └── patchwork-example-1.png ├── import │ └── figure-html │ │ ├── unnamed-chunk-4-1.png │ │ ├── unnamed-chunk-5-1.png │ │ └── unnamed-chunk-6-1.png ├── purrr │ └── figure-html │ │ ├── unnamed-chunk-10-1.png │ │ └── unnamed-chunk-10-2.png ├── functions │ └── figure-html │ │ ├── unnamed-chunk-2-1.png │ │ ├── unnamed-chunk-2-2.png │ │ └── unnamed-chunk-3-1.png ├── site_libs │ ├── ionicons-2.0.1 │ │ ├── fonts │ │ │ ├── ionicons.eot │ │ │ ├── ionicons.ttf │ │ │ ├── ionicons.woff │ │ │ ├── FontAwesome.otf │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.ttf │ │ │ ├── fontawesome-webfont.woff │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ └── glyphicons-halflings-regular.woff │ │ ├── images │ │ │ ├── markers-soft.png │ │ │ ├── markers-matte.png │ │ │ ├── markers-plain.png │ │ │ ├── markers-shadow.png │ │ │ ├── markers-matte@2x.png │ │ │ ├── markers-shadow@2x.png │ │ │ └── markers-soft@2x.png │ │ ├── leaflet.awesome-markers.min.js │ │ ├── leaflet.awesome-markers.css │ │ └── leaflet.awesome-markers.js │ ├── leaflet-1.3.1 │ │ └── images │ │ │ ├── layers.png │ │ │ ├── layers-2x.png │ │ │ ├── marker-icon.png │ │ │ ├── marker-shadow.png │ │ │ └── marker-icon-2x.png │ ├── reactable-0.4.4 │ │ ├── reactable.yaml │ │ └── reactable.server.js.LICENSE.txt │ ├── dygraphs-1.1.1 │ │ ├── dygraph.css │ │ └── shapes.js │ ├── rstudio_leaflet-1.3.1 │ │ ├── images │ │ │ └── 1px.png │ │ └── rstudio_leaflet.css │ ├── leaflet-locationfilter2-0.1.1 │ │ ├── img │ │ │ ├── filter-icon.png │ │ │ ├── move-handle.png │ │ │ └── resize-handle.png │ │ ├── locationfilter-bindings.js │ │ └── locationfilter.css │ ├── plotly-htmlwidgets-css-2.11.1 │ │ └── plotly-htmlwidgets.css │ ├── ionrangeslider-css-2.3.1 │ │ ├── scss │ │ │ ├── _mixins.scss │ │ │ ├── _base.scss │ │ │ └── shiny.scss │ │ └── css │ │ │ └── ion.rangeSlider.css │ ├── ionrangeslider-javascript-2.3.1 │ │ ├── scss │ │ │ ├── _mixins.scss │ │ │ ├── _base.scss │ │ │ └── shiny.scss │ │ └── css │ │ │ └── ion.rangeSlider.css │ ├── moment-fquarter-1.0.0 │ │ └── moment-fquarter.min.js │ ├── dt-ext-scroller-bootstrap-1.13.4 │ │ ├── css │ │ │ └── scroller.bootstrap.min.css │ │ └── js │ │ │ └── scroller.bootstrap.min.js │ ├── dt-ext-scroller-bootstrap-1.13.6 │ │ ├── js │ │ │ └── scroller.bootstrap.min.js │ │ └── css │ │ │ └── scroller.bootstrap.min.css │ ├── leafletfix-1.0.0 │ │ └── leafletfix.css │ ├── leaflet-easybutton-1.3.1 │ │ ├── LICENSE │ │ ├── EasyButton-binding.js │ │ └── easy-button.css │ ├── core-js-2.5.3 │ │ ├── LICENSE │ │ └── package.json │ ├── react-17.0.0 │ │ └── LICENSE.txt │ ├── react-18.2.0 │ │ └── LICENSE.txt │ ├── crosstalk-1.2.0 │ │ ├── css │ │ │ └── crosstalk.min.css │ │ └── scss │ │ │ └── crosstalk.scss │ ├── datatables-css-0.0.0 │ │ └── datatables-crosstalk.css │ ├── dt-core-bootstrap-1.13.6 │ │ ├── js │ │ │ └── dataTables.bootstrap.min.js │ │ └── css │ │ │ └── dataTables.bootstrap.extra.css │ ├── dt-core-bootstrap-1.13.4 │ │ ├── js │ │ │ └── dataTables.bootstrap.min.js │ │ └── css │ │ │ └── dataTables.bootstrap.extra.css │ ├── pagedtable-1.1 │ │ └── css │ │ │ └── pagedtable.css │ └── strftime-0.9.2 │ │ └── strftime-min.js ├── regression │ └── figure-html │ │ ├── unnamed-chunk-15-1.png │ │ ├── unnamed-chunk-15-2.png │ │ └── unnamed-chunk-6-1.png ├── longer_wider │ └── figure-html │ │ ├── unnamed-chunk-10-1.png │ │ ├── unnamed-chunk-11-1.png │ │ ├── unnamed-chunk-12-1.png │ │ ├── unnamed-chunk-7-1.png │ │ ├── unnamed-chunk-8-1.png │ │ └── unnamed-chunk-9-1.png └── tidy_tuesday_itra │ └── figure-html │ ├── unnamed-chunk-19-1.png │ ├── unnamed-chunk-20-1.png │ ├── unnamed-chunk-21-1.png │ ├── unnamed-chunk-22-1.png │ ├── unnamed-chunk-23-1.png │ ├── unnamed-chunk-24-1.png │ ├── unnamed-chunk-25-1.png │ ├── unnamed-chunk-27-1.png │ └── unnamed-chunk-27-2.png ├── .gitattributes ├── Intro2R.Rproj ├── _redirects ├── netlify.toml ├── _exercises ├── 05_functions_exercise.qmd ├── answers │ ├── 05_functions_answers.qmd │ ├── 02_viz_interactivity_answers.qmd │ ├── 04_join_answers.qmd │ ├── 03_pivot_answers.qmd │ ├── 00_import_answers.qmd │ ├── 06_nest_answers.Rmd │ ├── 02_viz_ggplot2_answers.qmd │ └── 01_dplyr_answers.qmd ├── 02_viz_interactivity.qmd ├── 04_join.qmd ├── 03_pivot.qmd ├── 02_viz.qmd ├── 06_nest_exercise.Rmd ├── 01_dplyr.qmd └── 00_import_data.qmd ├── map_import_clean_regex.qmd ├── README.md ├── tidymodels.qmd ├── about.qmd ├── eda.qmd ├── quarto.qmd ├── references.bib ├── widgets.qmd ├── schedule.qmd ├── join.qmd ├── packages.qmd ├── wrangle.qmd ├── _quarto.yml ├── data-sources-for-regression-analysis.qmd ├── index.qmd └── import.qmd /publish.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^LICENSE\.md$ 2 | -------------------------------------------------------------------------------- /styles.css: -------------------------------------------------------------------------------- 1 | /* css styles */ 2 | -------------------------------------------------------------------------------- /images/console.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/images/console.jpg -------------------------------------------------------------------------------- /images/quarto.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/images/quarto.jpg -------------------------------------------------------------------------------- /images/install_r.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/images/install_r.jpg -------------------------------------------------------------------------------- /images/projects.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/images/projects.jpg -------------------------------------------------------------------------------- /images/rfun_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/images/rfun_logo.png -------------------------------------------------------------------------------- /images/tidy_data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/images/tidy_data.png -------------------------------------------------------------------------------- /images/data_import.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/images/data_import.jpg -------------------------------------------------------------------------------- /images/join_diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/images/join_diagram.png -------------------------------------------------------------------------------- /images/packages_run.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/images/packages_run.jpg -------------------------------------------------------------------------------- /images/github_download.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/images/github_download.jpg -------------------------------------------------------------------------------- /images/packages_load.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/images/packages_load.jpg -------------------------------------------------------------------------------- /images/quarto_project.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/images/quarto_project.jpg -------------------------------------------------------------------------------- /images/data_import_code.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/images/data_import_code.jpg -------------------------------------------------------------------------------- /images/install_packages.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/images/install_packages.jpg -------------------------------------------------------------------------------- /images/package_tidyverse.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/images/package_tidyverse.jpg -------------------------------------------------------------------------------- /data/Employee_Sample_Data.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/data/Employee_Sample_Data.csv -------------------------------------------------------------------------------- /images/gganmimate_example.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/images/gganmimate_example.gif -------------------------------------------------------------------------------- /images/new_quarto_document.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/images/new_quarto_document.jpg -------------------------------------------------------------------------------- /images/visualization-themes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/images/visualization-themes.png -------------------------------------------------------------------------------- /images/prefers_global_options.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/images/prefers_global_options.jpg -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .Rdata 4 | .httr-oauth 5 | .DS_Store 6 | .quarto 7 | 8 | /.quarto/ 9 | /_site/ 10 | -------------------------------------------------------------------------------- /images/DALL-E_2023-07-13_learn_R.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/images/DALL-E_2023-07-13_learn_R.png -------------------------------------------------------------------------------- /images/prefers_global_options_pipe.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/images/prefers_global_options_pipe.jpg -------------------------------------------------------------------------------- /images/prefers_global_options_general.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/images/prefers_global_options_general.jpg -------------------------------------------------------------------------------- /_publish.yml: -------------------------------------------------------------------------------- 1 | - source: project 2 | netlify: 3 | - id: 77b7ca51-64d2-4322-aa81-165791d19879 4 | url: 'https://intro2r.library.duke.edu' 5 | -------------------------------------------------------------------------------- /images/DALL-E_2023-07-12_learn_R-coding.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/images/DALL-E_2023-07-12_learn_R-coding.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/plot-sleep-labs-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/plot-sleep-labs-1.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/unnamed-chunk-10-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/unnamed-chunk-10-1.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/unnamed-chunk-11-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/unnamed-chunk-11-1.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/unnamed-chunk-12-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/unnamed-chunk-12-1.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/unnamed-chunk-13-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/unnamed-chunk-13-1.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/unnamed-chunk-14-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/unnamed-chunk-14-1.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/unnamed-chunk-15-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/unnamed-chunk-15-1.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/unnamed-chunk-16-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/unnamed-chunk-16-1.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/unnamed-chunk-17-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/unnamed-chunk-17-1.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/unnamed-chunk-18-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/unnamed-chunk-18-1.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/unnamed-chunk-19-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/unnamed-chunk-19-1.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/unnamed-chunk-2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/unnamed-chunk-2-1.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/unnamed-chunk-20-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/unnamed-chunk-20-1.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/unnamed-chunk-21-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/unnamed-chunk-21-1.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/unnamed-chunk-22-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/unnamed-chunk-22-1.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/unnamed-chunk-23-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/unnamed-chunk-23-1.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/unnamed-chunk-24-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/unnamed-chunk-24-1.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/unnamed-chunk-25-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/unnamed-chunk-25-1.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/unnamed-chunk-27-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/unnamed-chunk-27-1.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/unnamed-chunk-28-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/unnamed-chunk-28-1.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/unnamed-chunk-29-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/unnamed-chunk-29-1.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/unnamed-chunk-30-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/unnamed-chunk-30-1.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/unnamed-chunk-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/unnamed-chunk-4-1.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/unnamed-chunk-5-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/unnamed-chunk-5-1.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/unnamed-chunk-6-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/unnamed-chunk-6-1.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/unnamed-chunk-7-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/unnamed-chunk-7-1.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/unnamed-chunk-8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/unnamed-chunk-8-1.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/unnamed-chunk-9-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/unnamed-chunk-9-1.png -------------------------------------------------------------------------------- /images/DALL-E_2023-07-13_learn_R_orignal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/images/DALL-E_2023-07-13_learn_R_orignal.png -------------------------------------------------------------------------------- /_freeze/import/figure-html/unnamed-chunk-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/import/figure-html/unnamed-chunk-4-1.png -------------------------------------------------------------------------------- /_freeze/import/figure-html/unnamed-chunk-5-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/import/figure-html/unnamed-chunk-5-1.png -------------------------------------------------------------------------------- /_freeze/import/figure-html/unnamed-chunk-6-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/import/figure-html/unnamed-chunk-6-1.png -------------------------------------------------------------------------------- /_freeze/purrr/figure-html/unnamed-chunk-10-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/purrr/figure-html/unnamed-chunk-10-1.png -------------------------------------------------------------------------------- /_freeze/purrr/figure-html/unnamed-chunk-10-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/purrr/figure-html/unnamed-chunk-10-2.png -------------------------------------------------------------------------------- /_freeze/viz/figure-html/patchwork-example-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/viz/figure-html/patchwork-example-1.png -------------------------------------------------------------------------------- /_freeze/functions/figure-html/unnamed-chunk-2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/functions/figure-html/unnamed-chunk-2-1.png -------------------------------------------------------------------------------- /_freeze/functions/figure-html/unnamed-chunk-2-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/functions/figure-html/unnamed-chunk-2-2.png -------------------------------------------------------------------------------- /_freeze/functions/figure-html/unnamed-chunk-3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/functions/figure-html/unnamed-chunk-3-1.png -------------------------------------------------------------------------------- /_freeze/site_libs/ionicons-2.0.1/fonts/ionicons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/site_libs/ionicons-2.0.1/fonts/ionicons.eot -------------------------------------------------------------------------------- /_freeze/site_libs/ionicons-2.0.1/fonts/ionicons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/site_libs/ionicons-2.0.1/fonts/ionicons.ttf -------------------------------------------------------------------------------- /_freeze/site_libs/leaflet-1.3.1/images/layers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/site_libs/leaflet-1.3.1/images/layers.png -------------------------------------------------------------------------------- /images/Little_reproducibility_project_pyramid.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/images/Little_reproducibility_project_pyramid.jpg -------------------------------------------------------------------------------- /_freeze/regression/figure-html/unnamed-chunk-15-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/regression/figure-html/unnamed-chunk-15-1.png -------------------------------------------------------------------------------- /_freeze/regression/figure-html/unnamed-chunk-15-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/regression/figure-html/unnamed-chunk-15-2.png -------------------------------------------------------------------------------- /_freeze/regression/figure-html/unnamed-chunk-6-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/regression/figure-html/unnamed-chunk-6-1.png -------------------------------------------------------------------------------- /_freeze/site_libs/ionicons-2.0.1/fonts/ionicons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/site_libs/ionicons-2.0.1/fonts/ionicons.woff -------------------------------------------------------------------------------- /_freeze/site_libs/leaflet-1.3.1/images/layers-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/site_libs/leaflet-1.3.1/images/layers-2x.png -------------------------------------------------------------------------------- /_freeze/site_libs/reactable-0.4.4/reactable.yaml: -------------------------------------------------------------------------------- 1 | dependencies: 2 | - name: reactable 3 | version: 0.4.4 4 | src: htmlwidgets 5 | stylesheet: reactable.css 6 | -------------------------------------------------------------------------------- /_freeze/longer_wider/figure-html/unnamed-chunk-10-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/longer_wider/figure-html/unnamed-chunk-10-1.png -------------------------------------------------------------------------------- /_freeze/longer_wider/figure-html/unnamed-chunk-11-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/longer_wider/figure-html/unnamed-chunk-11-1.png -------------------------------------------------------------------------------- /_freeze/longer_wider/figure-html/unnamed-chunk-12-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/longer_wider/figure-html/unnamed-chunk-12-1.png -------------------------------------------------------------------------------- /_freeze/longer_wider/figure-html/unnamed-chunk-7-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/longer_wider/figure-html/unnamed-chunk-7-1.png -------------------------------------------------------------------------------- /_freeze/longer_wider/figure-html/unnamed-chunk-8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/longer_wider/figure-html/unnamed-chunk-8-1.png -------------------------------------------------------------------------------- /_freeze/longer_wider/figure-html/unnamed-chunk-9-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/longer_wider/figure-html/unnamed-chunk-9-1.png -------------------------------------------------------------------------------- /_freeze/site_libs/dygraphs-1.1.1/dygraph.css: -------------------------------------------------------------------------------- 1 | 2 | div .dygraphs input[type="text"] { 3 | width: 25px; 4 | } 5 | 6 | div .qt .dygraph-axis-label { 7 | font-size: 11px; 8 | } -------------------------------------------------------------------------------- /_freeze/site_libs/ionicons-2.0.1/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/site_libs/ionicons-2.0.1/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /_freeze/site_libs/ionicons-2.0.1/images/markers-soft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/site_libs/ionicons-2.0.1/images/markers-soft.png -------------------------------------------------------------------------------- /_freeze/site_libs/leaflet-1.3.1/images/marker-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/site_libs/leaflet-1.3.1/images/marker-icon.png -------------------------------------------------------------------------------- /_freeze/site_libs/leaflet-1.3.1/images/marker-shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/site_libs/leaflet-1.3.1/images/marker-shadow.png -------------------------------------------------------------------------------- /_freeze/site_libs/rstudio_leaflet-1.3.1/images/1px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/site_libs/rstudio_leaflet-1.3.1/images/1px.png -------------------------------------------------------------------------------- /data/student_satisfaction_test-data_from_qualtrics.sav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/data/student_satisfaction_test-data_from_qualtrics.sav -------------------------------------------------------------------------------- /_freeze/site_libs/ionicons-2.0.1/images/markers-matte.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/site_libs/ionicons-2.0.1/images/markers-matte.png -------------------------------------------------------------------------------- /_freeze/site_libs/ionicons-2.0.1/images/markers-plain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/site_libs/ionicons-2.0.1/images/markers-plain.png -------------------------------------------------------------------------------- /_freeze/site_libs/ionicons-2.0.1/images/markers-shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/site_libs/ionicons-2.0.1/images/markers-shadow.png -------------------------------------------------------------------------------- /_freeze/site_libs/leaflet-1.3.1/images/marker-icon-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/site_libs/leaflet-1.3.1/images/marker-icon-2x.png -------------------------------------------------------------------------------- /_freeze/site_libs/ionicons-2.0.1/images/markers-matte@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/site_libs/ionicons-2.0.1/images/markers-matte@2x.png -------------------------------------------------------------------------------- /_freeze/site_libs/ionicons-2.0.1/images/markers-shadow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/site_libs/ionicons-2.0.1/images/markers-shadow@2x.png -------------------------------------------------------------------------------- /_freeze/site_libs/ionicons-2.0.1/images/markers-soft@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/site_libs/ionicons-2.0.1/images/markers-soft@2x.png -------------------------------------------------------------------------------- /_freeze/tidy_tuesday_itra/figure-html/unnamed-chunk-19-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/tidy_tuesday_itra/figure-html/unnamed-chunk-19-1.png -------------------------------------------------------------------------------- /_freeze/tidy_tuesday_itra/figure-html/unnamed-chunk-20-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/tidy_tuesday_itra/figure-html/unnamed-chunk-20-1.png -------------------------------------------------------------------------------- /_freeze/tidy_tuesday_itra/figure-html/unnamed-chunk-21-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/tidy_tuesday_itra/figure-html/unnamed-chunk-21-1.png -------------------------------------------------------------------------------- /_freeze/tidy_tuesday_itra/figure-html/unnamed-chunk-22-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/tidy_tuesday_itra/figure-html/unnamed-chunk-22-1.png -------------------------------------------------------------------------------- /_freeze/tidy_tuesday_itra/figure-html/unnamed-chunk-23-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/tidy_tuesday_itra/figure-html/unnamed-chunk-23-1.png -------------------------------------------------------------------------------- /_freeze/tidy_tuesday_itra/figure-html/unnamed-chunk-24-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/tidy_tuesday_itra/figure-html/unnamed-chunk-24-1.png -------------------------------------------------------------------------------- /_freeze/tidy_tuesday_itra/figure-html/unnamed-chunk-25-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/tidy_tuesday_itra/figure-html/unnamed-chunk-25-1.png -------------------------------------------------------------------------------- /_freeze/tidy_tuesday_itra/figure-html/unnamed-chunk-27-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/tidy_tuesday_itra/figure-html/unnamed-chunk-27-1.png -------------------------------------------------------------------------------- /_freeze/tidy_tuesday_itra/figure-html/unnamed-chunk-27-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/tidy_tuesday_itra/figure-html/unnamed-chunk-27-2.png -------------------------------------------------------------------------------- /_freeze/site_libs/ionicons-2.0.1/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/site_libs/ionicons-2.0.1/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /_freeze/site_libs/ionicons-2.0.1/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/site_libs/ionicons-2.0.1/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /_freeze/site_libs/ionicons-2.0.1/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/site_libs/ionicons-2.0.1/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.Rmd linguist-language=R 2 | *.R linguist-language=R 3 | *.qmd linguist-language=R 4 | *.html linguist-documentation 5 | *.css linguist-documentation 6 | *.js linguist-documentation 7 | -------------------------------------------------------------------------------- /_freeze/site_libs/leaflet-locationfilter2-0.1.1/img/filter-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/site_libs/leaflet-locationfilter2-0.1.1/img/filter-icon.png -------------------------------------------------------------------------------- /_freeze/site_libs/leaflet-locationfilter2-0.1.1/img/move-handle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/site_libs/leaflet-locationfilter2-0.1.1/img/move-handle.png -------------------------------------------------------------------------------- /_freeze/site_libs/ionicons-2.0.1/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/site_libs/ionicons-2.0.1/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /_freeze/site_libs/ionicons-2.0.1/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/site_libs/ionicons-2.0.1/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /_freeze/site_libs/leaflet-locationfilter2-0.1.1/img/resize-handle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/site_libs/leaflet-locationfilter2-0.1.1/img/resize-handle.png -------------------------------------------------------------------------------- /_freeze/site_libs/ionicons-2.0.1/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-and-visualization/Intro2R/HEAD/_freeze/site_libs/ionicons-2.0.1/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /Intro2R.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | -------------------------------------------------------------------------------- /_freeze/site_libs/plotly-htmlwidgets-css-2.11.1/plotly-htmlwidgets.css: -------------------------------------------------------------------------------- 1 | /* 2 | just here so that plotly works 3 | correctly with ioslides. 4 | see https://github.com/ropensci/plotly/issues/463 5 | */ 6 | 7 | slide:not(.current) .plotly.html-widget{ 8 | display: none; 9 | } 10 | -------------------------------------------------------------------------------- /_redirects: -------------------------------------------------------------------------------- 1 | # redirects from older version of website i.e. https://github.com/data-and-visualization/Intro2R/releases/tag/v1.0 2 | /data_management.html /import.html 3 | /data_wrangling.html /wrangle.html 4 | /visualization.html /viz.html 5 | /gis.html https://map-rfun.library.duke.edu/ 6 | /version_control.html https://git-rfun.library.duke.edu/ -------------------------------------------------------------------------------- /_freeze/site_libs/ionrangeslider-css-2.3.1/scss/_mixins.scss: -------------------------------------------------------------------------------- 1 | @mixin no-click() { 2 | -webkit-user-select: none; 3 | -khtml-user-select: none; 4 | -moz-user-select: none; 5 | -ms-user-select: none; 6 | user-select: none; 7 | } 8 | 9 | @mixin pos-r() { 10 | position: relative; 11 | display: block; 12 | } 13 | 14 | @mixin pos-a() { 15 | position: absolute; 16 | display: block; 17 | } 18 | -------------------------------------------------------------------------------- /_freeze/site_libs/ionrangeslider-javascript-2.3.1/scss/_mixins.scss: -------------------------------------------------------------------------------- 1 | @mixin no-click() { 2 | -webkit-user-select: none; 3 | -khtml-user-select: none; 4 | -moz-user-select: none; 5 | -ms-user-select: none; 6 | user-select: none; 7 | } 8 | 9 | @mixin pos-r() { 10 | position: relative; 11 | display: block; 12 | } 13 | 14 | @mixin pos-a() { 15 | position: absolute; 16 | display: block; 17 | } 18 | -------------------------------------------------------------------------------- /netlify.toml: -------------------------------------------------------------------------------- 1 | # COMMENT: redirect rules with all the fields expanded 2 | # According to netlify domain management 3 | # https://app.netlify.com/sites/intro2r/settings/domain#domains 4 | # # Redirect default Netlify subdomain to primary domain 5 | # https://intro2r.netlify.com/* https://intro2r.library.duke.edu/:splat 301! 6 | [[redirects]] 7 | from = "https://intro2r.netlify.com/*" 8 | to = "https://intro2r.library.duke.edu/:splat" 9 | status = 301 10 | force = true 11 | -------------------------------------------------------------------------------- /_freeze/site_libs/moment-fquarter-1.0.0/moment-fquarter.min.js: -------------------------------------------------------------------------------- 1 | (function(){function n(n){return n.fn.fquarter=function(n){var u=this.lang()._quarter||"Q",t={},r,i=null;return n=n||4,n>1?(r=this.subtract("months",n-1),i=r.clone().add("years",1)):r=this,t.quarter=Math.ceil((r.month()+1)/3),t.year=r.year(),t.nextYear=i?i.year():i,t.toString=function(){var n=u+t.quarter+" "+t.year;return i?n+"/"+i.format("YY"):n},t},n}typeof define=="function"&&define.amd?define("moment-fquarter",["moment"],n):typeof module!="undefined"?module.exports=n(require("moment")):typeof window!="undefined"&&window.moment&&n(window.moment)}).apply(this); -------------------------------------------------------------------------------- /_freeze/site_libs/dt-ext-scroller-bootstrap-1.13.4/css/scroller.bootstrap.min.css: -------------------------------------------------------------------------------- 1 | div.dts{display:block !important}div.dts tbody th,div.dts tbody td{white-space:nowrap}div.dts div.dts_loading{z-index:1}div.dts div.dts_label{position:absolute;right:10px;background:rgba(0, 0, 0, 0.8);color:white;box-shadow:3px 3px 10px rgba(0, 0, 0, 0.5);text-align:right;border-radius:3px;padding:.4em;z-index:2;display:none}div.dts div.dataTables_scrollBody{background:repeating-linear-gradient(45deg, #edeeff, #edeeff 10px, white 10px, white 20px)}div.dts div.dataTables_scrollBody table{background-color:white;z-index:2}div.dts div.dataTables_paginate,div.dts div.dataTables_length{display:none}div.DTS tbody tr{background-color:white} 2 | -------------------------------------------------------------------------------- /_exercises/05_functions_exercise.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Exercise 03" 3 | subtitle: "functions" 4 | --- 5 | 6 | Compose a function to take the square root, `sqrt()`, of a number which is multiplied by 10 7 | 8 | ```{r} 9 | library(tidyverse) 10 | ``` 11 | 12 | ```{r} 13 | sqrt_by_10 <- function(my_x) { 14 | _____(my_x * __) 15 | } 16 | ``` 17 | 18 | Execute the function 19 | 20 | ```{r} 21 | sqrt_by_10(______) 22 | 23 | sqrt(3 * 10) 24 | ``` 25 | 26 | Compose a function that multiplies two numbers 27 | 28 | ```{r} 29 | multiply_two_numbers <- function(_ , _) { 30 | (_ * _) 31 | } 32 | ``` 33 | 34 | Execute the function 35 | 36 | ```{r} 37 | starwars |> 38 | mutate(new_number = multiply_two_numbers(___, ____), .after = mass) 39 | ``` 40 | -------------------------------------------------------------------------------- /_exercises/answers/05_functions_answers.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Exercise 03" 3 | subtitle: "functions" 4 | --- 5 | 6 | Compose a function to take the square root, `sqrt()`, of a number which is multiplied by 10 7 | 8 | ```{r} 9 | library(tidyverse) 10 | ``` 11 | 12 | ```{r} 13 | sqrt_by_10 <- function(my_x) { 14 | sqrt(my_x * 10) 15 | } 16 | ``` 17 | 18 | Execute the function 19 | 20 | ```{r} 21 | sqrt_by_10(3) 22 | 23 | sqrt(3 * 10) 24 | ``` 25 | 26 | Compose a function that multiplies two numbers 27 | 28 | ```{r} 29 | multiply_two_numbers <- function(x, y) { 30 | (x * y) 31 | } 32 | ``` 33 | 34 | Execute the function 35 | 36 | ```{r} 37 | starwars |> 38 | mutate(new_number = multiply_two_numbers(mass, height), .after = mass) 39 | ``` 40 | -------------------------------------------------------------------------------- /_freeze/site_libs/dt-ext-scroller-bootstrap-1.13.4/js/scroller.bootstrap.min.js: -------------------------------------------------------------------------------- 1 | /*! Bootstrap 3 styling wrapper for Scroller 2 | * © SpryMedia Ltd - datatables.net/license 3 | */ 4 | !function(t){var o,d;"function"==typeof define&&define.amd?define(["jquery","datatables.net-bs","datatables.net-scroller"],function(e){return t(e,window,document)}):"object"==typeof exports?(o=require("jquery"),d=function(e,n){n.fn.dataTable||require("datatables.net-bs")(e,n),n.fn.dataTable.Scroller||require("datatables.net-scroller")(e,n)},"undefined"!=typeof window?module.exports=function(e,n){return e=e||window,n=n||o(e),d(e,n),t(n,0,e.document)}:(d(window,o),module.exports=t(o,window,window.document))):t(jQuery,window,document)}(function(e,n,t,o){"use strict";return e.fn.dataTable}); -------------------------------------------------------------------------------- /_freeze/site_libs/dt-ext-scroller-bootstrap-1.13.6/js/scroller.bootstrap.min.js: -------------------------------------------------------------------------------- 1 | /*! Bootstrap 3 styling wrapper for Scroller 2 | * © SpryMedia Ltd - datatables.net/license 3 | */ 4 | !function(t){var o,d;"function"==typeof define&&define.amd?define(["jquery","datatables.net-bs","datatables.net-scroller"],function(e){return t(e,window,document)}):"object"==typeof exports?(o=require("jquery"),d=function(e,n){n.fn.dataTable||require("datatables.net-bs")(e,n),n.fn.dataTable.Scroller||require("datatables.net-scroller")(e,n)},"undefined"==typeof window?module.exports=function(e,n){return e=e||window,n=n||o(e),d(e,n),t(n,0,e.document)}:(d(window,o),module.exports=t(o,window,window.document))):t(jQuery,window,document)}(function(e,n,t,o){"use strict";return e.fn.dataTable}); -------------------------------------------------------------------------------- /_exercises/answers/02_viz_interactivity_answers.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Visualization interactivity" 3 | --- 4 | 5 | ## Load library package 6 | 7 | ```{r} 8 | #| warning: false 9 | #| message: false 10 | library(tidyverse) 11 | ``` 12 | 13 | Make a barplot of the `gender` of starwars charactesrs 14 | 15 | ```{r} 16 | starwars |> 17 | ggplot(aes(gender)) + 18 | geom_bar() 19 | 20 | ``` 21 | 22 | Make a stacked barplot using the `fill` argument. Stack the bars with the values of the `sex` variable. Assign the plot to an object name: `star_gender`. 23 | 24 | ```{r} 25 | star_gender <- starwars |> 26 | ggplot(aes(gender)) + 27 | geom_bar(aes(fill = sex)) 28 | star_gender 29 | ``` 30 | 31 | ```{r} 32 | library(plotly) 33 | ``` 34 | 35 | ```{r} 36 | ggplotly(star_gender) 37 | ``` 38 | -------------------------------------------------------------------------------- /_exercises/02_viz_interactivity.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Visualization interactivity" 3 | --- 4 | 5 | ## Load library package 6 | 7 | ```{r} 8 | #| warning: false 9 | #| message: false 10 | library(tidyverse) 11 | ``` 12 | 13 | Make a barplot of the `gender` of starwars charactesrs 14 | 15 | ```{r} 16 | starwars |> 17 | ggplot(aes(gender)) + 18 | geom_bar() 19 | 20 | ``` 21 | 22 | Make a stacked bar plot, as above, using the `fill` argument. Stack the bars with the values of the `sex` variable. Assign the plot to an object name of `star_gender`. 23 | 24 | ```{r} 25 | _________ <- starwars |> 26 | ggplot(aes(gender)) + 27 | geom_bar(aes(____ = sex)) 28 | star_gender 29 | ``` 30 | 31 | Using the {`plotly`} package 32 | 33 | ```{r} 34 | library(plotly) 35 | ``` 36 | 37 | Make the `star_gender` object interactive 38 | 39 | ```{r} 40 | ggplotly(________) 41 | ``` 42 | -------------------------------------------------------------------------------- /_freeze/site_libs/leafletfix-1.0.0/leafletfix.css: -------------------------------------------------------------------------------- 1 | /* Work around CSS properties introduced on img by bootstrap */ 2 | img.leaflet-tile { 3 | padding: 0; 4 | margin: 0; 5 | border-radius: 0; 6 | border: none; 7 | } 8 | .leaflet .info { 9 | padding: 6px 8px; 10 | font: 14px/16px Arial, Helvetica, sans-serif; 11 | background: white; 12 | background: rgba(255,255,255,0.8); 13 | box-shadow: 0 0 15px rgba(0,0,0,0.2); 14 | border-radius: 5px; 15 | } 16 | .leaflet .legend { 17 | line-height: 18px; 18 | color: #555; 19 | } 20 | .leaflet .legend svg text { 21 | fill: #555; 22 | } 23 | .leaflet .legend svg line { 24 | stroke: #555; 25 | } 26 | .leaflet .legend i { 27 | width: 18px; 28 | height: 18px; 29 | margin-right: 4px; 30 | opacity: 0.7; 31 | display: inline-block; 32 | vertical-align: top; 33 | /*For IE 7*/ 34 | zoom: 1; 35 | *display: inline; 36 | } 37 | -------------------------------------------------------------------------------- /data/538_favorability_popularity.csv: -------------------------------------------------------------------------------- 1 | # These data are from https://github.com/fivethirtyeight/data/tree/master/star-wars-survey 2 | # They are transformed to keep only columns 16-29 3 | # sw_characters_favorability <- read_csv( 4 | # "https://raw.githubusercontent.com/fivethirtyeight/data/master/star-wars-survey/StarWars.csv", 5 | # skip = 1)[,16:29] 6 | # They are transformed in the following manner 7 | # favorability_popularity_rating <- sw_characters_favorability %>% 8 | # map_dfr(fct_count) %>% 9 | # filter(f == "Very favorably") %>% 10 | # add_column(name = colnames(sw_characters_favorability)) %>% 11 | # select(name, fav_rating = n) 12 | name,fav_rating 13 | Han Solo,610 14 | Luke Skywalker,552 15 | Princess Leia Organa,547 16 | Anakin Skywalker,245 17 | Obi Wan Kenobi,591 18 | Emperor Palpatine,110 19 | Darth Vader,310 20 | Lando Calrissian,142 21 | Boba Fett,138 22 | C-3P0,474 23 | R2 D2,562 24 | Jar Jar Binks,112 25 | Padme Amidala,168 26 | Yoda,605 27 | -------------------------------------------------------------------------------- /_freeze/site_libs/leaflet-easybutton-1.3.1/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2014 Daniel Montague 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /_freeze/site_libs/dt-ext-scroller-bootstrap-1.13.6/css/scroller.bootstrap.min.css: -------------------------------------------------------------------------------- 1 | div.dts{display:block !important}div.dts tbody th,div.dts tbody td{white-space:nowrap}div.dts div.dts_loading{z-index:1}div.dts div.dts_label{position:absolute;right:20px;background:rgba(0, 0, 0, 0.8);color:white;box-shadow:3px 3px 10px rgba(0, 0, 0, 0.5);text-align:right;border-radius:3px;padding:.4em;z-index:2;display:none}div.dts div.dataTables_scrollBody{background:repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.025), rgba(0, 0, 0, 0.025) 10px, rgba(0, 0, 0, 0) 10px, rgba(0, 0, 0, 0) 20px)}div.dts div.dataTables_scrollBody table{background-color:white;z-index:2}div.dts div.dataTables_paginate,div.dts div.dataTables_length{display:none}html.dark div.dts div.dts_label{background:rgba(255, 255, 255, 0.8);color:black}html.dark div.dts div.dataTables_scrollBody{background:repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.025) 10px, rgba(255, 255, 255, 0) 10px, rgba(255, 255, 255, 0) 20px)}html.dark div.dts div.dataTables_scrollBody table{background-color:var(--dt-html-background);z-index:2}div.DTS tbody tr{background-color:white} 2 | -------------------------------------------------------------------------------- /_exercises/answers/04_join_answers.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "join" 3 | 4 | date-modified: 'today' 5 | date-format: long 6 | 7 | format: 8 | html: 9 | footer: "CC BY 4.0 John R Little" 10 | 11 | license: CC BY 12 | --- 13 | 14 | ```{r} 15 | library(tidyverse) 16 | ``` 17 | 18 | ## Join 19 | 20 | There are a series of [join commands](https://dplyr.tidyverse.org/reference/index.html#section-two-table-verbs) 21 | 22 | - left_join, inner_join, right_join, full_join, 23 | - semi_join, anti_join 24 | 25 | ![dplyr joins visualized](https://pbs.twimg.com/media/B6eUTTACUAAahLf.png) 26 | 27 | ## data 28 | 29 | These exercises use the following [`dplyr` datasets](https://ggplot2.tidyverse.org/reference/index.html#section-data) 30 | 31 | - dplyr::band_instruments 32 | - dplyr::band_members 33 | 34 | ```{r} 35 | band_members 36 | band_instruments 37 | ``` 38 | 39 | ## Goal 40 | 41 | Make one big data frame that joins `band_members` with `band_instruments`. Using the template below you need to identify what type of join to use and identify the join key. 42 | 43 | ```{r} 44 | band_members |> 45 | left_join(band_instruments, by = "name") 46 | ``` 47 | -------------------------------------------------------------------------------- /_freeze/site_libs/leaflet-easybutton-1.3.1/EasyButton-binding.js: -------------------------------------------------------------------------------- 1 | getEasyButton = function(button) { 2 | 3 | var options = {}; 4 | 5 | options.position = button.position; 6 | 7 | // only add ID if provided 8 | if(button.id) { 9 | options.id = button.id; 10 | } 11 | 12 | // if custom states provided use that 13 | // else use provided icon and onClick 14 | if(button.states) { 15 | options.states = button.states; 16 | return L.easyButton(options); 17 | } else { 18 | return L.easyButton(button.icon, button.onClick, 19 | button.title, options ); 20 | } 21 | }; 22 | 23 | LeafletWidget.methods.addEasyButton = function(button) { 24 | getEasyButton(button).addTo(this); 25 | }; 26 | 27 | LeafletWidget.methods.addEasyButtonBar = function(buttons, position, id) { 28 | 29 | var options = {}; 30 | 31 | options.position = position; 32 | 33 | // only add ID if provided 34 | if(id) { 35 | options.id = id; 36 | } 37 | 38 | var easyButtons = []; 39 | for(var i=0; i < buttons.length; i++) { 40 | easyButtons[i] = getEasyButton(buttons[i]); 41 | } 42 | L.easyBar(easyButtons).addTo(this); 43 | 44 | }; 45 | -------------------------------------------------------------------------------- /_exercises/04_join.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "join" 3 | 4 | date-modified: 'today' 5 | date-format: long 6 | 7 | format: 8 | html: 9 | footer: "CC BY 4.0 John R Little" 10 | 11 | license: CC BY 12 | --- 13 | 14 | ```{r} 15 | library(tidyverse) 16 | ``` 17 | 18 | ## Join 19 | 20 | There are a series of [join commands](https://dplyr.tidyverse.org/reference/index.html#section-two-table-verbs) 21 | 22 | - left_join, inner_join, right_join, full_join, 23 | - semi_join, anti_join 24 | 25 | ![dplyr joins visualized](https://pbs.twimg.com/media/B6eUTTACUAAahLf.png) 26 | 27 | ## data 28 | 29 | These exercises use the following [`dplyr` datasets](https://ggplot2.tidyverse.org/reference/index.html#section-data) 30 | 31 | - dplyr::band_instruments 32 | - dplyr::band_members 33 | 34 | ```{r} 35 | band_members 36 | band_instruments 37 | ``` 38 | 39 | ## Goal 40 | 41 | Make one big data frame that joins `band_members` with `band_instruments`. Using the template below you need to identify what type of join to use and identify the join key. 42 | 43 | ```{r} 44 | #| eval: false 45 | band_members |> 46 | ----_join(band_instruments, by = "----") 47 | ``` 48 | -------------------------------------------------------------------------------- /_freeze/site_libs/core-js-2.5.3/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014-2017 Denis Pushkarev 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /_freeze/site_libs/react-17.0.0/LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2013-present, Facebook, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /_freeze/site_libs/react-18.2.0/LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2013-present, Facebook, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /map_import_clean_regex.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Import multiple Excel files" 3 | subtitle: "Casestudy of purrr::map() to make one big data frame" 4 | --- 5 | 6 | The [code](https://github.com/libjohn/workshop_rfun_iterate) and companion [youtube playlist](https://www.youtube.com/watch?v=QgasjZGhWlk&list=PLIUcX1JrVUNWW7RgPh9ysmJM3mBpIAlYG&index=1) show practical R/data-wrangling **tips** and **tricks**. This case study demonstrates custom *functions*, *regex* (regular expressions), and *iteration*. The workflow shows techniques for common needs such: data-scraping, ingesting multiple files, transforming messy data into tidy data, quickly cleaning column names, separating multivalue fields, uniting variable values, and nesting data. 7 | 8 | ## Playlist 9 | 10 | 13 | 14 | ## Code and data 15 | 16 | Github ▶️ [libjohn/workshop_rfun/iterate](https://github.com/libjohn/workshop_rfun_iterate) 17 | -------------------------------------------------------------------------------- /_exercises/03_pivot.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "03 pivot data" 3 | author: "John Little" 4 | 5 | date-modified: 'today' 6 | date-format: long 7 | 8 | format: 9 | html: 10 | footer: "CC BY 4.0 John R Little" 11 | 12 | license: CC BY 13 | --- 14 | 15 | ```{r} 16 | library(tidyverse) 17 | ``` 18 | 19 | ## data 20 | 21 | These exercises use the following [`ggplot2` training datasets](https://ggplot2.tidyverse.org/reference/index.html#section-data) 22 | 23 | - ggplot2::economics 24 | 25 | ## Pivot 26 | 27 | Below are two data frames. One is wide data, the other is long. 28 | 29 | ```{r} 30 | economics 31 | economics_long %>% arrange(date) 32 | ``` 33 | 34 | ## Goal 35 | 36 | Using one of the dplyr pivot functions, pivot the economics data to long format 37 | 38 | ```{r} 39 | economics %>% 40 | pivot_------(cols = pce:unemploy, 41 | names_to = "variable", 42 | values_to = "value") 43 | ``` 44 | 45 | Now that the data are long. Can you use the `facet_wrap()` function to make multiple line plots, one line plot for each `variable` category? 46 | 47 | ```{r} 48 | economics |> 49 | pivot_longer(-date, names_to = "variable", values_to = "value") |> 50 | ggplot(aes(date, value)) + 51 | geom____() + 52 | facet_wrap(vars(_______)) 53 | ``` 54 | -------------------------------------------------------------------------------- /_freeze/site_libs/leaflet-easybutton-1.3.1/easy-button.css: -------------------------------------------------------------------------------- 1 | .leaflet-bar button, 2 | .leaflet-bar button:hover { 3 | background-color: #fff; 4 | border: none; 5 | border-bottom: 1px solid #ccc; 6 | width: 26px; 7 | height: 26px; 8 | line-height: 26px; 9 | display: block; 10 | text-align: center; 11 | text-decoration: none; 12 | color: black; 13 | } 14 | 15 | .leaflet-bar button { 16 | background-position: 50% 50%; 17 | background-repeat: no-repeat; 18 | overflow: hidden; 19 | display: block; 20 | } 21 | 22 | .leaflet-bar button:hover { 23 | background-color: #f4f4f4; 24 | } 25 | 26 | .leaflet-bar button:first-of-type { 27 | border-top-left-radius: 4px; 28 | border-top-right-radius: 4px; 29 | } 30 | 31 | .leaflet-bar button:last-of-type { 32 | border-bottom-left-radius: 4px; 33 | border-bottom-right-radius: 4px; 34 | border-bottom: none; 35 | } 36 | 37 | .leaflet-bar.disabled, 38 | .leaflet-bar button.disabled { 39 | cursor: default; 40 | pointer-events: none; 41 | opacity: .4; 42 | } 43 | 44 | .easy-button-button .button-state{ 45 | display: block; 46 | width: 100%; 47 | height: 100%; 48 | position: relative; 49 | } 50 | 51 | 52 | .leaflet-touch .leaflet-bar button { 53 | width: 30px; 54 | height: 30px; 55 | line-height: 30px; 56 | } 57 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Introduction to R workshop 2 | 3 | 4 | 5 | 6 | 7 | For more information or resource on learning R, please visit the [Rfun learning series](https://Rfun.library.duke.edu). 8 | 9 | This website is composed in the [RStudio IDE](https://posit.co/download/rstudio-desktop/), as [R code](https://en.wikipedia.org/wiki/R_(programming_language)) authored as a [Quarto](https://quarto.org/) notebooks. With Quarto it is easy to render multiple report formats, such as a PDF document or this website. In this case the report format is a [web site hosted](https://intro2R.library.duke.edu/) at netlify. The code for this workshop and this webpage are all part of a single RStudio project that can be [found in a GitHub repository](https://github.com/data-and-visualization/Intro2R/). 10 | 11 | The code-along exercises for this workshop are in the GitHub repository but they are not part of the web site. You can work through the exercises by first downloading the GitHub repository. Then, find the exercises within the `_exercises` directory. 12 | 13 | ```{=html} 14 | 21 | ``` 22 | -------------------------------------------------------------------------------- /_freeze/site_libs/rstudio_leaflet-1.3.1/rstudio_leaflet.css: -------------------------------------------------------------------------------- 1 | .leaflet-tooltip.leaflet-tooltip-text-only, 2 | .leaflet-tooltip.leaflet-tooltip-text-only:before, 3 | .leaflet-tooltip.leaflet-tooltip-text-only:after { 4 | background: none; 5 | border: none; 6 | box-shadow: none; 7 | } 8 | 9 | .leaflet-tooltip.leaflet-tooltip-text-only.leaflet-tooltip-left { 10 | margin-left: 5px; 11 | } 12 | 13 | .leaflet-tooltip.leaflet-tooltip-text-only.leaflet-tooltip-right { 14 | margin-left: -5px; 15 | } 16 | 17 | .leaflet-tooltip:after { 18 | border-right: 6px solid transparent; 19 | /* right: -16px; */ 20 | } 21 | 22 | .leaflet-popup-pane .leaflet-popup-tip-container { 23 | /* when the tooltip container is clicked, it is closed */ 24 | pointer-events: all; 25 | /* tooltips should display the "hand" icon, just like .leaflet-interactive*/ 26 | cursor: pointer; 27 | } 28 | 29 | /* have the widget be displayed in the right 'layer' */ 30 | .leaflet-map-pane { 31 | z-index: auto; 32 | } 33 | 34 | /* Add missing rule from leaflet for img. 35 | This complete existing leaflet.css. 36 | Fix for https://github.com/rstudio/rmarkdown/issues/1949 */ 37 | .leaflet-container .leaflet-right-pane img, 38 | .leaflet-container .leaflet-left-pane img { 39 | max-width: none !important; 40 | max-height: none !important; 41 | } 42 | -------------------------------------------------------------------------------- /_freeze/site_libs/crosstalk-1.2.0/css/crosstalk.min.css: -------------------------------------------------------------------------------- 1 | .container-fluid.crosstalk-bscols{margin-left:-30px;margin-right:-30px;white-space:normal}body>.container-fluid.crosstalk-bscols{margin-left:auto;margin-right:auto}.crosstalk-input-checkboxgroup .crosstalk-options-group .crosstalk-options-column{display:inline-block;padding-right:12px;vertical-align:top}@media only screen and (max-width: 480px){.crosstalk-input-checkboxgroup .crosstalk-options-group .crosstalk-options-column{display:block;padding-right:inherit}}.crosstalk-input{margin-bottom:15px}.crosstalk-input .control-label{margin-bottom:0;vertical-align:middle}.crosstalk-input input[type="checkbox"]{margin:4px 0 0;margin-top:1px;line-height:normal}.crosstalk-input .checkbox{position:relative;display:block;margin-top:10px;margin-bottom:10px}.crosstalk-input .checkbox>label{padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer}.crosstalk-input .checkbox input[type="checkbox"],.crosstalk-input .checkbox-inline input[type="checkbox"]{position:absolute;margin-top:2px;margin-left:-20px}.crosstalk-input .checkbox+.checkbox{margin-top:-5px}.crosstalk-input .checkbox-inline{position:relative;display:inline-block;padding-left:20px;margin-bottom:0;font-weight:400;vertical-align:middle;cursor:pointer}.crosstalk-input .checkbox-inline+.checkbox-inline{margin-top:0;margin-left:10px} 2 | -------------------------------------------------------------------------------- /_exercises/answers/03_pivot_answers.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "03 pivot data" 3 | author: "John Little" 4 | 5 | date-modified: 'today' 6 | date-format: long 7 | 8 | format: 9 | html: 10 | footer: "CC BY 4.0 John R Little" 11 | 12 | license: CC BY 13 | --- 14 | 15 | ```{r} 16 | library(tidyverse) 17 | ``` 18 | 19 | ## data 20 | 21 | These exercises use the following [`ggplot2` training datasets](https://ggplot2.tidyverse.org/reference/index.html#section-data) 22 | 23 | - ggplot2::economics 24 | 25 | ## Pivot 26 | 27 | Below are two data frames. One is wide data, the other is long. 28 | 29 | ```{r} 30 | economics 31 | economics_long %>% arrange(date) 32 | ``` 33 | 34 | ## Goal 35 | 36 | Using one of the dplyr pivot functions, pivot the economics data to long format 37 | 38 | ```{r} 39 | economics %>% 40 | pivot_longer(cols = pce:unemploy, 41 | names_to = "variable", 42 | values_to = "value") 43 | ``` 44 | 45 | or 46 | 47 | ```{r} 48 | economics |> 49 | pivot_longer(-date, names_to = "variable", values_to = "value") 50 | ``` 51 | 52 | Now that the data are long. Can you use the `facet_wrap()` function to make multiple line plots, one line plot for each `variable` category? 53 | 54 | ```{r} 55 | economics |> 56 | pivot_longer(-date, names_to = "variable", values_to = "value") |> 57 | ggplot(aes(date, value)) + 58 | geom_line() + 59 | facet_wrap(vars(variable)) 60 | ``` 61 | -------------------------------------------------------------------------------- /tidymodels.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Tidymodels and machine learning" 3 | date-modified: 'today' 4 | date-format: long 5 | 6 | license: CC BY-NC 7 | bibliography: references.bib 8 | --- 9 | 10 | The {tidymodels} concept [@kuhn2022] is a group of packages in support of modeling and machine learning. In the [last section](regression.html) we learned how to manipulate a basic linear model though a combination of the base-R `lm()` function and the tidyverse {broom} package along with the `nest()` function. However, modeling can be much more involved. This basic overview introduces tidymodels, a conceptual approach to integrating tidyverse principles with modeling, machine learning, feature selection and tuning. 11 | 12 | Beyond the core of integrating machine learning and modeling with the tidyverse, tidymodels supports a variety of useful analytical and computational approaches. A short list of examples includes **statistical analysis** (e.g. bootstrapping, hypothesis testing, k-means clustering, logistic regression, etc.), **robust modeling** (e.g. classification, least squares, resampling), creating **performance metrics**, **tuning, clustering, classification, text analysis, neural networks**, and more. 13 | 14 | ## Get started 15 | 16 | Modelers and ML coders can approach tidymodels by 17 | 18 | 1. Engaging with the [five-step tutorial](https://www.tidymodels.org/start/) (build a model, use recipes to pre-process data, evaluate with resampling, tune, and predict. 19 | 20 | 2. [Dive deeper to find articles that help apply the tidymodels approach](https://www.tidymodels.org/learn/) to your needs. 21 | -------------------------------------------------------------------------------- /_freeze/site_libs/reactable-0.4.4/reactable.server.js.LICENSE.txt: -------------------------------------------------------------------------------- 1 | /* 2 | object-assign 3 | (c) Sindre Sorhus 4 | @license MIT 5 | */ 6 | 7 | /*! 8 | * The buffer module from node.js, for the browser. 9 | * 10 | * @author Feross Aboukhadijeh 11 | * @license MIT 12 | */ 13 | 14 | /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ 15 | 16 | /*! safe-buffer. MIT License. Feross Aboukhadijeh */ 17 | 18 | /** @license React v0.20.2 19 | * scheduler.production.min.js 20 | * 21 | * Copyright (c) Facebook, Inc. and its affiliates. 22 | * 23 | * This source code is licensed under the MIT license found in the 24 | * LICENSE file in the root directory of this source tree. 25 | */ 26 | 27 | /** @license React v17.0.2 28 | * react-dom-server.node.production.min.js 29 | * 30 | * Copyright (c) Facebook, Inc. and its affiliates. 31 | * 32 | * This source code is licensed under the MIT license found in the 33 | * LICENSE file in the root directory of this source tree. 34 | */ 35 | 36 | /** @license React v17.0.2 37 | * react-dom.production.min.js 38 | * 39 | * Copyright (c) Facebook, Inc. and its affiliates. 40 | * 41 | * This source code is licensed under the MIT license found in the 42 | * LICENSE file in the root directory of this source tree. 43 | */ 44 | 45 | /** @license React v17.0.2 46 | * react.production.min.js 47 | * 48 | * Copyright (c) Facebook, Inc. and its affiliates. 49 | * 50 | * This source code is licensed under the MIT license found in the 51 | * LICENSE file in the root directory of this source tree. 52 | */ 53 | -------------------------------------------------------------------------------- /_freeze/site_libs/datatables-css-0.0.0/datatables-crosstalk.css: -------------------------------------------------------------------------------- 1 | .dt-crosstalk-fade { 2 | opacity: 0.2; 3 | } 4 | 5 | html body div.DTS div.dataTables_scrollBody { 6 | background: none; 7 | } 8 | 9 | 10 | /* 11 | Fix https://github.com/rstudio/DT/issues/563 12 | If the `table.display` is set to "block" (e.g., pkgdown), the browser will display 13 | datatable objects strangely. The search panel and the page buttons will still be 14 | in full-width but the table body will be "compact" and shorter. 15 | In therory, having this attributes will affect `dom="t"` 16 | with `display: block` users. But in reality, there should be no one. 17 | We may remove the below lines in the future if the upstream agree to have this there. 18 | See https://github.com/DataTables/DataTablesSrc/issues/160 19 | */ 20 | 21 | table.dataTable { 22 | display: table; 23 | } 24 | 25 | 26 | /* 27 | When DTOutput(fill = TRUE), it receives a .html-fill-item class (via htmltools::bindFillRole()), which effectively amounts to `flex: 1 1 auto`. That's mostly fine, but the case where `fillContainer=TRUE`+`height:auto`+`flex-basis:auto` and the container (e.g., a bslib::card()) doesn't have a defined height is a bit problematic since the table wants to fit the parent but the parent wants to fit the table, which results pretty small table height (maybe because there is a minimum height somewhere?). It seems better in this case to impose a 400px height default for the table, which we can do by setting `flex-basis` to 400px (the table is still allowed to grow/shrink when the container has an opinionated height). 28 | */ 29 | 30 | .html-fill-container > .html-fill-item.datatables { 31 | flex-basis: 400px; 32 | } 33 | -------------------------------------------------------------------------------- /about.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "About" 3 | 4 | date-modified: 'today' 5 | date-format: long 6 | 7 | license: CC BY-NC 8 | bibliography: references.bib 9 | --- 10 | 11 | This website is hosted by the [Center for Data & Visualization Sciences](https://library.duke.edu/data/), part of the [Duke University Libraries](https://library.duke.edu). composed in the [RStudio IDE](https://posit.co/download/rstudio-desktop/), as [R code](https://en.wikipedia.org/wiki/R_(programming_language)) authored as a [Quarto](https://quarto.org/) notebooks. With Quarto it is easy to render multiple report formats such as a PDF document or this website. In this case the report format is a [web site hosted](https://intro2R.library.duke.edu/) gratis at netlify. 12 | 13 | ::: {style="text-align: center"} 14 | ![](images/rfun_logo.png) 15 | ::: 16 | 17 | Formerly, this site was known as the Rfun site. The content from that site has been consolidated here. 18 | 19 | The code for this workshop and this webpage are all part of a single RStudio project that can be [found in a GitHub repository](https://github.com/data-and-visualization/Intro2R). The code-along exercises for this workshop are in the GitHub repository but they are not part of the web site. You can work through the exercises by first downloading the GitHub repository. Then find the exercises within the `_exercises` directory. 20 | 21 | You can find an [**outline** for this](outline.html) workshop. For more information or resource on learning R, please also visit the [Rfun learning series](https://Rfun.library.duke.edu). 22 | 23 | ## Misc 24 | 25 | ::: {.callout-note collapse="true"} 26 | ## Earlier version of a package? 27 | 28 | `remotes::install_version("knitr", "1.42")` 29 | ::: 30 | -------------------------------------------------------------------------------- /_freeze/site_libs/leaflet-locationfilter2-0.1.1/locationfilter-bindings.js: -------------------------------------------------------------------------------- 1 | /* global LeafletWidget, L, Shiny, HTMLWidgets, $ */ 2 | 3 | function getLocationFilterBounds(locationFilter) { 4 | if(locationFilter && locationFilter.getBounds) { 5 | var bounds = locationFilter.getBounds(); 6 | var boundsJSON = 7 | { 8 | "sw_lat" : bounds.getSouth(), 9 | "sw_lng" : bounds.getWest(), 10 | "ne_lat" : bounds.getNorth(), 11 | "ne_lng" : bounds.getEast() 12 | }; 13 | return boundsJSON; 14 | } else { 15 | return null; 16 | } 17 | } 18 | 19 | LeafletWidget.methods.addLocationFilter = function(options) { 20 | (function() { 21 | var map = this; 22 | 23 | if(map.locationFilter) { 24 | map.locationFilter.remove(); 25 | map.locationFilter = null; 26 | } 27 | 28 | if(!$.isEmptyObject(options.bounds)) { 29 | options.bounds = L.latLngBounds(options.bounds); 30 | } 31 | 32 | map.locationFilter = new L.LocationFilter(options); 33 | 34 | map.locationFilter.on("change", function(e) { 35 | if (!HTMLWidgets.shinyMode) return; 36 | Shiny.onInputChange(map.id+"_location_filter_changed", 37 | getLocationFilterBounds(map.locationFilter)); 38 | }); 39 | map.locationFilter.on("enabled", function(e) { 40 | if (!HTMLWidgets.shinyMode) return; 41 | Shiny.onInputChange(map.id+"_location_filter_enabled", 42 | getLocationFilterBounds(map.locationFilter)); 43 | }); 44 | map.locationFilter.on("disabled", function(e) { 45 | if (!HTMLWidgets.shinyMode) return; 46 | Shiny.onInputChange(map.id+"_location_filter_disabled", 47 | getLocationFilterBounds(map.locationFilter)); 48 | }); 49 | 50 | map.locationFilter.addTo(map); 51 | 52 | }).call(this); 53 | }; 54 | 55 | LeafletWidget.methods.removeLocationFilter = function() { 56 | (function() { 57 | var map = this; 58 | 59 | if(map.locationFilter) { 60 | map.locationFilter.remove(); 61 | map.locationFilter = null; 62 | } 63 | 64 | }).call(this); 65 | }; 66 | 67 | -------------------------------------------------------------------------------- /_freeze/site_libs/crosstalk-1.2.0/scss/crosstalk.scss: -------------------------------------------------------------------------------- 1 | /* Adjust margins outwards, so column contents line up with the edges of the 2 | parent of container-fluid. */ 3 | .container-fluid.crosstalk-bscols { 4 | margin-left: -30px; 5 | margin-right: -30px; 6 | white-space: normal; 7 | } 8 | 9 | /* But don't adjust the margins outwards if we're directly under the body, 10 | i.e. we were the top-level of something at the console. */ 11 | body > .container-fluid.crosstalk-bscols { 12 | margin-left: auto; 13 | margin-right: auto; 14 | } 15 | 16 | .crosstalk-input-checkboxgroup .crosstalk-options-group .crosstalk-options-column { 17 | display: inline-block; 18 | padding-right: 12px; 19 | vertical-align: top; 20 | } 21 | 22 | @media only screen and (max-width:480px) { 23 | .crosstalk-input-checkboxgroup .crosstalk-options-group .crosstalk-options-column { 24 | display: block; 25 | padding-right: inherit; 26 | } 27 | } 28 | 29 | /* Relevant BS3 styles to make filter_checkbox() look reasonable without Bootstrap */ 30 | .crosstalk-input { 31 | margin-bottom: 15px; /* a la .form-group */ 32 | .control-label { 33 | margin-bottom: 0; 34 | vertical-align: middle; 35 | } 36 | input[type="checkbox"] { 37 | margin: 4px 0 0; 38 | margin-top: 1px; 39 | line-height: normal; 40 | } 41 | .checkbox { 42 | position: relative; 43 | display: block; 44 | margin-top: 10px; 45 | margin-bottom: 10px; 46 | } 47 | .checkbox > label{ 48 | padding-left: 20px; 49 | margin-bottom: 0; 50 | font-weight: 400; 51 | cursor: pointer; 52 | } 53 | .checkbox input[type="checkbox"], 54 | .checkbox-inline input[type="checkbox"] { 55 | position: absolute; 56 | margin-top: 2px; 57 | margin-left: -20px; 58 | } 59 | .checkbox + .checkbox { 60 | margin-top: -5px; 61 | } 62 | .checkbox-inline { 63 | position: relative; 64 | display: inline-block; 65 | padding-left: 20px; 66 | margin-bottom: 0; 67 | font-weight: 400; 68 | vertical-align: middle; 69 | cursor: pointer; 70 | } 71 | .checkbox-inline + .checkbox-inline { 72 | margin-top: 0; 73 | margin-left: 10px; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /eda.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Exploratory Data Analysis packages" 3 | date-modified: 'today' 4 | date-format: long 5 | 6 | license: CC BY-NC 7 | bibliography: references.bib 8 | --- 9 | 10 | EDA, or Exploratory Data Analysis can take many forms. This brief section will recommend a few packages which can be used to explore your data, more or less, automagically. The packages can be complex and may take some effort to learn. However, if you're brand new to data mining, you may benefit from reading these package documentation pages, and then applying their functions to your data. 11 | 12 | Recommended EDA packages 13 | 14 | - {skimr} - [https://docs.ropensci.org/skimr](https://docs.ropensci.org/skimrhttps://github.com/taiyun/corrplot/)\ 15 | a frictionless approach to summary statistics 16 | 17 | - {gtExtras} - [https://jthomasmock.github.io/gtExtras/reference/gt_plt_summary.html](https://jthomasmock.github.io/gtExtras/reference/gt_plt_summary.htmlhttps://jthomasmock.github.io/gtExtras/reference/gt_plt_summary.html)\ 18 | create a summary table with historgrams or area bar chatrs from a dataframe 19 | 20 | - {DataExplorer} - [https://boxuancui.github.io/DataExplorer/reference/plot_intro.html](https://boxuancui.github.io/DataExplorer/reference/plot_intro.htmlhttps://boxuancui.github.io/DataExplorer/reference/plot_intro.html)\ 21 | Plot basic information 22 | 23 | - {corrplot} - [https://github.com/taiyun/corrplot](https://github.com/taiyun/corrplot/)\ 24 | a visual exploratory tool on correlation matrix that supports automatic variable reordering 25 | 26 | - {summarytools} - [https://github.com/dcomtois/summarytools](https://github.com/dcomtois/summarytoolshttps://github.com/dcomtois/summarytools)\ 27 | or data cleaning, exploring, and simple reporting 28 | 29 | - {tableone} - [https://github.com/kaz-yos/tableone](https://github.com/kaz-yos/tableonehttps://github.com/kaz-yos/tableone)\ 30 | create "Table 1", description of baseline characteristics 31 | 32 | - {dtracker} - [https://terminological.github.io/dtrackr](https://terminological.github.io/dtrackr/)\ 33 | Accurate documentation of a data pipeline is a first step to reproducibility, and a flow chart describing the steps taken to prepare data 34 | -------------------------------------------------------------------------------- /_freeze/site_libs/dt-core-bootstrap-1.13.6/js/dataTables.bootstrap.min.js: -------------------------------------------------------------------------------- 1 | /*! DataTables Bootstrap 3 integration 2 | * ©2011-2015 SpryMedia Ltd - datatables.net/license 3 | */ 4 | !function(t){var n,i;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return t(e,window,document)}):"object"==typeof exports?(n=require("jquery"),i=function(e,a){a.fn.dataTable||require("datatables.net")(e,a)},"undefined"==typeof window?module.exports=function(e,a){return e=e||window,a=a||n(e),i(e,a),t(a,0,e.document)}:(i(window,n),module.exports=t(n,window,window.document))):t(jQuery,window,document)}(function(x,e,n,i){"use strict";var r=x.fn.dataTable;return x.extend(!0,r.defaults,{dom:"<'row'<'col-sm-6'l><'col-sm-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-5'i><'col-sm-7'p>>",renderer:"bootstrap"}),x.extend(r.ext.classes,{sWrapper:"dataTables_wrapper form-inline dt-bootstrap",sFilterInput:"form-control input-sm",sLengthSelect:"form-control input-sm",sProcessing:"dataTables_processing panel panel-default"}),r.ext.renderer.pageButton.bootstrap=function(s,e,d,a,l,c){function u(e,a){for(var t,n,i=function(e){e.preventDefault(),x(e.currentTarget).hasClass("disabled")||b.page()==e.data.action||b.page(e.data.action).draw("page")},r=0,o=a.length;r",{class:m.sPageButton+" "+f,id:0===d&&"string"==typeof t?s.sTableId+"_"+t:null}).append(x("",{href:n?null:"#","aria-controls":s.sTableId,"aria-disabled":n?"true":null,"aria-label":w[t],role:"link","aria-current":"active"===f?"page":null,"data-dt-idx":t,tabindex:n?-1:s.iTabIndex}).html(p)).appendTo(e),s.oApi._fnBindAction(n,{action:t},i))}}var p,f,t,b=new r.Api(s),m=s.oClasses,g=s.oLanguage.oPaginate,w=s.oLanguage.oAria.paginate||{};try{t=x(e).find(n.activeElement).data("dt-idx")}catch(e){}u(x(e).empty().html('