All datasets and functions required for the examples and exercises of the book “Data Science for Psychologists” (by Hansjoerg Neth, Konstanz University, 2022), available at https://bookdown.org/hneth/ds4psy/. 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.
The book and course Data Science for Psychologists includes the following resources:
Release of ds4psy (0.8.0) on CRAN adds functionality, increases modularity, and fixes some bugs. [2022-04-08]
Changes since last release:
invert_rules()
function (for decoding encoded messages by inverting the rules used for encoding).words_to_text()
function as the inverse of text_to_words()
.zodiac()
function (with multiple outputs formats and options for redefining date boundaries).table9
as a variant of tidyr::table2
as a 3-dimensional array (xtabs).capitalize()
to also work for character vectors (i.e., setting the case of each element to upper- or lowercase).The current development version of ds4psy is hosted at https://github.com/hneth/ds4psy/.
Release of ds4psy (0.7.0) on CRAN adds functionality, increases modularity, and fixes a bug in text data. [2021-05-12]
Changes since last release:
Breaking change: The function read_ascii()
was split into 2 parts (to enable independent access to their functionality):
read_ascii()
version reads text (from file or user input) into a character string;map_text_coord()
function converts a text string into a table of individual characters (with x/y-coordinates).Added plot_chars()
for plotting characters of text and visualizing pattern matches (specified as regular expressions) by highlighting labels (color/angle) or background tiles (color). The function uses 2 auxiliary functions:
map_text_regex()
adds pattern matching options (for colors and angles) to map_text_coord()
.plot_charmap()
plots character maps as text and tile plots (with aesthetics for labels and tiles).count_chars_words()
for counting the frequency of both characters and words in text strings.plot_mar
argument to theme_empty()
plot_text()
(but see plot_chars()
)text_to_chars()
and related functions for converting character strings (e.g., text to characters, preserving spaces)is_vector()
to is_vect()
as an is_vector()
function is defined by the purrr packageplot_text()
Trumpisms
The current development version of ds4psy is hosted at https://github.com/hneth/ds4psy/.
Release of ds4psy (0.6.0) on CRAN adds functionality, updates data, and reduces dependencies. [2021-04-08]
Changes since last release:
is_vector()
to check for vectors (i.e., atomic vectors or lists)get_set()
for motivating visualizationsfame
and Trumpisms
theme_empty()
Release of ds4psy (0.5.0) on CRAN adds and revises functionality, updates data, and fixes bugs. [2020-09-01]
Changes since last release:
Additional functions for dates and times:
diff_dates()
to compute temporal differences between dates (in human time units of years, months, and days)diff_times()
to compute temporal differences between times (in human time units of years, …, and seconds)diff_tz()
to compute time difference based on time zone differencesdays_in_month()
to obtain number of days in months for given dates (accounting for leap years)is_equal()
and num_equal()
to check pairwise (near) equality of vectorstheme_clean()
as an alternative to theme_ds4psy()
is.wholenumber()
to is_wholenumber()
sample_date()
and sample_time()
to align with sample()
theme_ds4psy()
to provide control over colors of backgrounds, lines, and text elementsfame
datanum_as_char()
now also works for negative numbers.is_leap_year()
(which yielded FALSE
for NA
inputs).\u2212
(minus sign) by -
(dash) in exp_num_dt$blood_type
to prevent Note on “marked UTF-8 strings”.Release of ds4psy (0.4.0) on CRAN adds new functionality and fixes minor bugs. [2020-07-06]
Changes since last release:
This version adds support for processing data with dates and times:
change_tz()
and change_time()
functions for changing the display of calendar times (“POSIXct”) to local times (“POSIXlt”) in different time zones tz
, and vice versa (i.e., changing actual time, but preserving time display).is_leap_year()
function checks dates and times (or integers denoting years in 4-digit “%Y” format) for falling within a leap year.dt_10
and exp_num_dt
support exercises on dates and times.cur_date()
and cur_time()
now print date/time (as string) or return a “Date”/“POSIXct” object.what_date()
and what_time()
gain support for adding time zones tz
(but no active conversion).sample_time()
: Switch default to sampling “POSIXct” objects (making “POSIXlt” optional) and allow specifying time zones tz
.cur_date()
, what_date()
, etc.) now use Sys.Date()
(i.e., an object of class “Date”) rather than Sys.time()
(i.e., a “POSIXct” calendar time) as default.is.wholenumber()
from is.integer()
\u...
rather than \U...
in Umlaut
definitionsfruits
and flowery
Release of ds4psy (0.3.0) on CRAN adds new functionality (e.g., support for processing text data, new datasets, and functions). [2020-06-15]
Changes since last release:
text_to_sentences()
and text_to_words()
functions for text processingcount_words()
(in analogy to count_chars()
) function for text processingcclass
(as a named character vector) for matching character classes in regular expressionsmetachar
(as a character vector) for matching meta-characters in regular expressionsUmlaut
(as a named character vector) for showing and selecting German Umlaut characterscountries
, fruits
, and flowery
phrases (as character vectors)Bushisms
and Trumpisms
(as character vectors)sample_char()
functionREADME.Rmd
count_char()
to count_chars()
(to use plural form)sample_date()
and sample_time()
(to use singular form)text functions
to text objects and functions
random functions
to sampling functions
Release of ds4psy (0.2.1) on CRAN is a maintenance release (to remove some dependencies, fix bugs on CRAN platforms, and add some datasets). [2020-05-06]
Changes since last release:
here
and tibble
packages (and remove these packages from declared Imports).t_1
–t_4
.what_day
with a simpler version that omits unit
and as_integer
arguments (to avoid WARN on CRAN for r-devel-linux-x86_64-debian-clang
).data$...
elements from aes()
in ggplot
callsutils::globalVariables(...)
to avoid Warning NOTE “Undefined global functions or variables”dplyr
, and magrittr
) from declared ImportsRelease of ds4psy (0.2.0) on CRAN adds functionality and fixes some bugs. [2020-04-20]
Changes since last release:
Changes involving new functionality include:
coin()
flips and dice()
throws)is.wholenumber()
to test for integer values (mentioned in R oddities)plot_text()
plotting functionread_ascii()
and count_chars()
functions for text processingcaseflip()
and capitalize()
functions for text processingsample_date()
and sample_time()
)cur_date()
, cur_time()
, for Chapter 10: Time data)what_
functions for simple date and time queries (for Chapter 10: Time data)make_grid()
for an exercise on visual illusions (Exercise 6 of Chapter 2)fame
dataset to illustrate working with dates (Exercise 3 of Chapter 10)num_as_char()
and num_as_ordinal()
(to be used in Chapter 11: Functions)data.R
)plot_fun.R
)Initial release of ds4psy (0.1.0) on CRAN. [2019-08-10]
The initial functionality is limited, as the package is designed to support the emerging ds4psy book:
[File NEWS.md
updated on 2022-04-08.]