Using fancy tools like neural nets, boosting, and support vector machines without understanding basic statistics is like doing brain surgery before knowing how to use a band-aid.

(Wasserman, 2004, p. vii/viii)

This book is not on statistics, but covers the foundations of dealing with data in psychology and a variety of other contexts. Although it is possible to study statistics as a mathematical discipline, actually collecting and analyzing data requires some of the methods and skills conveyed here. Originally, I merely started to elaborate upon chapters of R for Data Science . As my students struggled with this text, I began selecting and summarizing essential concepts and commands and adapted the examples and exercises to the needs of students in psychology and social sciences. And as R reaches far beyond the tidyverse, I added base R sections and solutions to complement the perspective embraced by the original source. By now, most chapters here contain a mix of summaries and new materials, and can be studied independently or as parts of a larger curriculum.

### Contents and audience

This book allows teaching a variety of introductory courses on data science for students of psychology and related fields. The term data science here is mainly a place holder for “methods, skills, and tools dealing with data.” As this book focuses on the basics (i.e., data types and shapes, and ways of loading, transforming, summarizing, and visualizing data), it does not cover topics like machine learning, modeling, or statistics. This may initially disappoint some students, but the above quote by also applies to these applications: When other introductory texts promise them, they rarely deliver a sound introduction that is suited to novices. And whoever aims to develop statistical models or advance machine learning needs a solid understanding of the basics to successfully venture into new territory.

The chapters of this book can be arranged into a variety of courses. Depending on your goals, student needs, and the length of the teaching period, some of the more specialized topics (e.g., Chapter 9 on Strings of text, Chapter 10 on Dates and times, or Appendix E on regular expressions) can be skipped, or used as the basis of a more advanced curriculum. Similarly, combining the chapters of Part I and Part IV with some appendices (e.g., Appendix D on using colors in R and Appendix F on using R Markdown) provides a general introduction to data literacy and reproducible research in R, without focusing on particular packages or data wrangling tasks. More specialized courses on statistics or modeling could only use Chapter 1 to introduce Basic R concepts and commands.

The book was conceived with psychologists in mind, but its materials and examples hope to engage students and researchers from various backgrounds and invite them to apply computational tools to solve challenging problems in their fields. Hopefully, readers will welcome the numerous summaries, cross-references, and links to further resources, and find the large number of practice tasks and exercises entertaining and enlightening.

### Providing feedback

As data science is a dynamic field and this text is being revised on a regular basis, it is likely that the current version contains some typos and mistakes. Please feel free to contact me (as h.neth at uni.kn) to report errors, possible improvements, or any other feedback or observations that you are willing to share.

Everyone likes being linked or cited. Feel free to adopt this book or parts of it to your own purposes, but please acknowledge its use in your own work. As the structure of the book’s chapters and sections may change, links should only use the base URL https://bookdown.org/hneth/ds4psy/.

To cite this book or the corresponding R package ds4psy , please use:

• Neth, H. (2021). ds4psy: Data Science for Psychologists.
Social Psychology and Decision Sciences, University of Konstanz, Germany.
Textbook and R package (version 0.7.0, May 12, 2021).

A BibTeX entry for LaTeX users is:

@Manual{ds4psy,
title = {ds4psy: Data Science for Psychologists},
author = {Hansjörg Neth},
year = {2021},
organization = {Social Psychology and Decision Sciences, University of Konstanz},
note = {Textbook and R package (version 0.7.0, May 12, 2021)},
url = {https://bookdown.org/hneth/ds4psy/}
}

The URL of the R package ds4psy is https://CRAN.R-project.org/package=ds4psy.

The HTML-version of this book uses Google Analytics to evaluate the popularity of its different chapters. The website does not collect any personal data of individual users.

### Colophon

This book was generated using R version 4.0.5 (2021-03-31) and the following packages:

• bardr (0.0.9), base (4.0.5), BayesFactor (0.9.12.4.2), bookdown (0.20), circlize (0.4.12), coda (0.19.4), datasets (4.0.5), devtools (2.4.2), dplyr (1.0.7), ds4psy (0.7.0.9005), forcats (0.5.1), ggplot2 (3.3.5), graphics (4.0.5), grDevices (4.0.5), grid (4.0.5), here (1.0.1), jpeg (0.1.8.1), knitr (1.34), lubridate (1.7.10), magrittr (2.0.1), Matrix (1.3.2), methods (4.0.5), purrr (0.3.4), RColorBrewer (1.1.2), readr (2.0.1), rmarkdown (2.10), stats (4.0.5), stringr (1.4.0), tibble (3.1.4), tidyr (1.1.3), tidyverse (1.3.1), unikn (0.4.0.9005), usethis (2.0.1), utils (4.0.5), viridis (0.5.1), viridisLite (0.4.0), yarrr (0.1.5).

Thanks to all package authors and the R community for making this book possible!

[85_coda.Rmd updated on 2021-09-22 20:38:37 by hn.]