-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathREADME.Rmd
More file actions
333 lines (196 loc) · 15.1 KB
/
README.Rmd
File metadata and controls
333 lines (196 loc) · 15.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit THIS (Rmd) file. -->
<!-- Devel badges start: -->
[](https://CRAN.R-project.org/package=ds4psy)
[](https://www.r-pkg.org/pkg/ds4psy)
[](https://www.r-pkg.org/pkg/ds4psy)
[](https://doi.org/10.5281/zenodo.7229812)
<!-- Devel badges end. -->
<!-- <!-- Release badges start: -->
<!-- [](https://CRAN.R-project.org/package=ds4psy) -->
<!-- [](https://www.r-pkg.org/pkg/ds4psy) -->
<!-- [](https://doi.org/10.5281/zenodo.7229812) -->
<!-- Release badges end. -->
<!-- ALL status badges:
[](https://CRAN.R-project.org/package=ds4psy)
[](https://travis-ci.org/hneth/ds4psy)
[](https://www.r-pkg.org/pkg/ds4psy)
[](https://www.r-pkg.org/pkg/ds4psy)
[](https://www.rdocumentation.org/packages/ds4psy)
-->
```{r setup, include = FALSE}
# Default chunk options:
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
# Some URLs (from ds4psy ebook): ----
# Posit connect cloud hosting:
url_posit_hneth <- "https://connect.posit.cloud/hneth/"
# (1) ds4psy: ------
url_ds4psy_book_old <- "https://bookdown.org/hneth/ds4psy/" # moved to:
url_ds4psy_book <- "https://hneth-ds4psy.share.connect.posit.cloud/"
url_ds4psy_cran <- "https://CRAN.R-project.org/package=ds4psy"
# (2) i2ds: ------
url_i2ds_book_old <- "https://bookdown.org/hneth/i2ds/" # moved to:
url_i2ds_book <- "https://hneth-i2ds.share.connect.posit.cloud/"
```
<!-- ds4psy logo 1: -->
<!-- <a href="`r url_ds4psy_book`"> -->
<!-- <img src = "./inst/images/logo.png" alt = "ds4psy" width = "150px" align = "right" style = "width: 150px; float: right; border:11;"/> -->
<!-- </a> -->
# Data Science for Psychologists (ds4psy) <img src = "./inst/images/logo.png" align = "right" alt = "ds4psy" width = "150px" />
Welcome to the R package **ds4psy** — a software companion to the books and courses
**[Data Science for Psychologists](`r url_ds4psy_book`)** and
**[Introduction to Data Science](`r url_i2ds_book`)**.
This **R package** provides datasets and functions used in the
[ds4psy](`r url_ds4psy_book`) and
[i2ds](`r url_i2ds_book`) textbooks and corresponding course curricula.
These books and courses introduce the principles and methods of data science for students of psychology and other biological or social sciences.
<!-- Description of ds4psy package: -->
<!-- All datasets and functions required for the examples and exercises of the book "Data Science for Psychologists" (by Hansjoerg Neth, Konstanz University, 2025), freely available at <https://hneth-ds4psy.share.connect.posit.cloud/>. The book and course introduce principles and methods of data science to students of psychology and other biological or social sciences. The 'ds4psy' package primarily provides datasets, but also functions for data generation and manipulation (e.g., of text and time data) and graphics that are used in the book and its exercises. All functions included in 'ds4psy' are designed to be explicit and instructive, rather than efficient or elegant. -->
## Installation
<!-- R package ds4psy at CRAN: -->
The current release of **ds4psy** is available from [CRAN](https://CRAN.R-project.org/) at <https://CRAN.R-project.org/package=ds4psy>:
```{r install_CRAN, echo = TRUE, eval = FALSE}
install.packages('ds4psy') # install ds4psy from CRAN client
library('ds4psy') # load to use the package
```
<!-- Development version: -->
The current development version of **ds4psy** (v`r packageVersion('ds4psy')`) can be installed from its [GitHub](https://github.com) repository at <https://github.com/hneth/ds4psy/>:
```{r install_github, echo = TRUE, eval = FALSE}
# install.packages('devtools') # (if not installed yet)
devtools::install_github('hneth/ds4psy')
library('ds4psy') # load to use the package
```
<!-- Corresponding textbooks: ds4psy vs. i2ds -->
### Textbooks {-}
The R package **[ds4psy](`r url_ds4psy_cran`)** is used by 2 textbooks that are freely available online.
Current versions of the **[ds4psy book](`r url_ds4psy_book`)** and **[i2ds book](`r url_i2ds_book`)** are available at <`r url_ds4psy_book`> and <`r url_i2ds_book`>, respectively.
<!-- Textbooks at bookdown vs. the Posit Connect cloud: -->
### Change of hosting service and URLs {-}
Both textbooks were originally hosted at <https://bookdown.org> (up to 2026-01-15).
Static versions are still available at <`r url_ds4psy_book_old`> and <`r url_i2ds_book_old`>, respectively, but these are no longer updated.
Future versions will be hosted at <`r url_posit_hneth`>.
Hence, visit <`r url_ds4psy_book`> and <`r url_i2ds_book`> for the most recent versions.
## Course Coordinates
<!-- uni.kn logo, but link to SPDS: -->
<!--  -->
<a href="https://spds.uni-konstanz.de/">
<img src = "./inst/images/uniKn_logo.png" alt = "spds.uni.kn" width = "300px" align = "right" style = "width: 300px; float: right; border:20;"/>
</a>
* PSY-16620, at the [University of Konstanz](https://www.uni-konstanz.de) is taught by [Hansjörg Neth](https://spds.uni-konstanz.de//hans-neth), [Social Psychology and Decision Sciences](https://spds.uni-konstanz.de/), office\ D507
<!-- * Fall/Winter\ 2025/2026: Mondays, 13:30–15:00, D522. -->
* The [ds4psy](https://CRAN.R-project.org/package=ds4psy) R package is available at <https://CRAN.R-project.org/package=ds4psy>
* The [ds4psy book](`r url_ds4psy_book`) with examples and exercises is available at <`r url_ds4psy_book`>
* The [i2ds book](`r url_i2ds_book`) with more extensive materials and exercises is available at <`r url_i2ds_book`>
## Overview
This R package and the corresponding books and courses provide an introduction to data science that is tailored to the needs of students in psychology, but is also suitable for students of the humanities and other biological or social sciences.
This audience typically has some knowledge of statistics, but rarely an idea how data is prepared and shaped to allow for statistical testing.
By using various data types and working with many examples, we teach tools for transforming, summarizing, and visualizing data.
By keeping our eyes open for the perils of misleading representations, the book fosters fundamental skills of data literacy and cultivates reproducible research practices that enable and precede any practical use of statistics.
### Audiences
Students of psychology and other social sciences are trained to analyze data. But the data they learn to work with (e.g., in courses on statistics and empirical research methods) is typically provided to them and structured in a (rectangular or "tidy") format that presupposes many steps of data processing regarding the aggregation and spatial layout of variables. When beginning to collect their own data, students inevitably struggle with these pre-processing steps which — even for experienced data scientists — tend to require more time and effort than choosing and conducting statistical tests.
This course develops the foundations of data analysis that allow students to collect data from real-world sources and transform and shape such data to answer scientific and practical questions. Although there are many good introductions to data science (e.g., [Grolemund & Wickham, 2017](https://r4ds.had.co.nz/)) they typically do not take into account the special needs — and often anxieties and reservations — of psychology students. As social scientists are not computer scientists, we introduce new concepts and commands without assuming a mathematical or computational background. Adopting a task-oriented perspective, we begin with a specific problem and then solve it with some combination of data collection, manipulation, and visualization.
### Goals
Our main goal is to develop a set of useful skills in analyzing real-world data and conducting reproducible research. Upon completing this course, you will be able to use R to read, transform, analyze, and visualize data of various types. Many interactive exercises allow students to continuously check their understanding, practice their skills, and monitor their progress.
### Requirements
The courses using this package assume some basic familiarity with statistics and the [R](https://www.R-project.org/) programming language, but enthusiastic programming novices are welcome.
## Resources
<!-- i2ds book link and logo (on right): -->
<a href="`r url_i2ds_book`">
<img src = "./inst/images/i2ds_logo_1.png" alt = "i2ds" width = "160px" align = "right" style = "width: 160px; float: right; border:11;"/>
</a>
This package and the corresponding books are still being developed and are updated as new materials become available.
- The current version of the book **[Introduction to Data Science](`r url_i2ds_book`)** is available at <`r url_i2ds_book`>.
- The most recent version of the book **[Data Science for Psychologists](`r url_ds4psy_book`)** is available at <`r url_ds4psy_book`>.
- The current R package **ds4psy** is available at <https://CRAN.R-project.org/package=ds4psy>.
- For **ds4psy** sources, there are 2\ GitHub repositories to be distinguished:
- The repository for the [ds4psy package](https://CRAN.R-project.org/package=ds4psy) is <https://github.com/hneth/ds4psy>.
- The repository for the [ds4psy book](`r url_ds4psy_book`) is <https://github.com/hneth/ds4psy> (with an additional suffix `_book`).
<!-- - The current course syllabus and raw versions of all data files used in examples and exercises are available at <http://rpository.com/ds4psy/>. -->
## References
### Course materials
- The current textbook **[Introduction to Data Science](`r url_i2ds_book`)** is online at <`r url_i2ds_book`>.
- The most recent version of **[Data science for psychologists](`r url_ds4psy_book`)** is online at <`r url_ds4psy_book`>.
<!-- Background / origin: -->
These books and courses were originally based on the classic textbook:
- Wickham, H., & Grolemund, G. (2017).
_R for data science: Import, tidy, transform, visualize, and model data._
Sebastopol, Canada: O'Reilly Media, Inc. (available online at <https://r4ds.had.co.nz/>)
<!-- Our focus: base R before tidyverse -->
but provide more **base**\ R and less **tidyverse** content.
<!-- Add blank line. -->
### Software
Please install the following open-source programs on your computer:
- [The R Project for Statistical Computing](https://www.R-project.org/)
- [R Studio](https://posit.co/products/open-source/rstudio) is an integrated development environment (IDE) for R.
- R\ packages of the [tidyverse](https://tidyverse.org/), [ds4psy](https://CRAN.R-project.org/package=ds4psy), and [unikn](https://CRAN.R-project.org/package=unikn):
<!-- Add blank line. -->
```{r install-pkgs, eval = FALSE, warning = FALSE}
# Tidyverse packages:
install.packages('tidyverse')
# Course packages:
install.packages('ds4psy') # datasets and functions
install.packages('unikn') # color palettes and functions
```
### Other resources
#### R manuals and books
- [R\ manuals](https://cran.r-project.org/manuals.html) and related [books](https://www.r-project.org/doc/bib/R-books.html)
- See the books on R and data science available on <https://bookdown.org>.
<!-- - Zumel, N., & Mount, J. (2014). _Practical data science with R_. Greenwich, CT: Manning Publications. -->
#### Software tools
- [Posit.co](https://posit.co/) resources: [RStudio IDE](https://posit.co/products/open-source/rstudio), [R\ Markdown](https://rmarkdown.rstudio.com/), and various [cheat sheets](https://opensource.posit.co/resources/cheatsheets/)
- [Tidyverse](https://tidyverse.org/) resources: [blog](https://tidyverse.org/blog/) and [learn](https://tidyverse.org/learn/)
<!-- Add blank line. -->
- See also the link collections at the end of each chapter of the [ds4psy book](`r url_ds4psy_book`).
## About
If you find these materials useful, or want to adopt or alter them for your purposes, please
[let me know](https://spds.uni-konstanz.de//hans-neth).
### Citation
<!-- ds4psy logo: -->
<a href="`r url_ds4psy_book`">
<img src = "./inst/images/logo.png" alt = "ds4psy" width = "150px" align = "right" style = "width: 150px; float: right; border:11;"/>
</a>
To cite **ds4psy** in derivations and publications, please use:
- Neth, H. (2026). ds4psy: Data Science for Psychologists.
Social Psychology and Decision Sciences, University of Konstanz, Germany.
Textbook and R package (version 1.3.0, April 22, 2026).
Retrieved from <`r url_ds4psy_book`>.
doi [10.5281/zenodo.7229812](https://doi.org/10.5281/zenodo.7229812)
<!-- BibTeX reference: -->
A **BibTeX** entry for LaTeX users is:
```{r bitex-entry, echo = FALSE, eval = FALSE, highlight = FALSE}
@Manual{ds4psy,
title = {ds4psy: Data Science for Psychologists},
author = {Hansjörg Neth},
year = {2026},
organization = {Social Psychology and Decision Sciences, University of Konstanz},
address = {Konstanz, Germany},
note = {Textbook and R package (version 1.3.0, April 22, 2026)},
url = {`r url_ds4psy_book`},
doi = {10.5281/zenodo.7229812}
}
```
<!-- BibTeX entry of current version: -->
```{r pkg-unicol-citation, echo = FALSE, eval = TRUE, comment = "", highlight = FALSE}
# From package citation:
x <- citation(package = 'ds4psy')
# print(x, prefix = "")
utils::toBibtex(x)
```
<!-- Note URL of pkg: -->
The stable URL of the **ds4psy** R package is <https://CRAN.R-project.org/package=ds4psy>.
### License
<!-- (a) Use online image: -->
<a rel="license" href="https://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a>
<!-- (b) Use local image: -->
<!-- <a rel="license" href="https://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src = "./images/CC_BY_NC_SA.png" /></a> -->
<!-- License text: -->
<span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">**Data science for psychologists** (**ds4psy**)</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="https://neth.de" property="cc:attributionName" rel="cc:attributionURL">Hansjörg Neth</a> is licensed under a <a rel="license" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License</a>.
------
<!-- Footer: -->
[File `README.md` updated on `r Sys.Date()`.]
<!-- eof. -->