Skip to content

Commit

Permalink
Merge pull request #28 from mccarthy-m-g/chapter-12
Browse files Browse the repository at this point in the history
Update Chapter 12
  • Loading branch information
mccarthy-m-g authored Jun 20, 2024
2 parents 6fe9ba6 + bbc1c2f commit c1598d8
Show file tree
Hide file tree
Showing 13 changed files with 63,239 additions and 62,708 deletions.
24 changes: 9 additions & 15 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ NULL
#'
#' Data from Gamse and Conger (1997) measuring the number of years to receiving
#' tenure in a sample of 260 semifinalists and fellowship recipients in the
#' National Academy of EducationSpencer Foundation PostDoctoral Fellowship
#' National Academy of Education--Spencer Foundation Post-Doctoral Fellowship
#' Program who took an academic job after earning a doctorate. Academics were
#' followed for up to nine years or until they received tenure.
#'
Expand Down Expand Up @@ -527,16 +527,12 @@ NULL
#'
#' \describe{
#' \item{`id`}{Participant ID.}
#' \item{`onset`}{Age of first depressive episode.}
#' \item{`age`}{Age each record corresponds to.}
#' \item{`event`}{Binary indicator for whether and when the adult experienced a depressive episode.}
#' \item{`censor`}{Censoring status.}
#' \item{`interview_age`}{Age at time of interview.}
#' \item{`parental_divorce`}{Binary indicator for whether the adult's parents divorced at this or any previous age.}
#' \item{`female`}{Binary indicator for whether the adult is a female.}
#' \item{`siblings`}{Number of siblings.}
#' \item{`bigfamily`}{Binary indicator for whether the adult has five or more siblings.}
#' \item{`period`}{Age each record corresponds to.}
#' \item{`depressive_episode`}{Binary indicator for whether the adult experienced a depressive episode.}
#' \item{`parental_divorce`}{Binary indicator for whether the adult's parents divorced at this or any previous age.}
#' \item{`parental_divorce_now`}{Binary indicator for whether the adult's parents divorced during the current period.}
#' }
#' @source
#' Wheaton, B., Roszell, P., & Hall, K. (1997). The impact of twenty childhood
Expand All @@ -558,12 +554,11 @@ NULL
#'
#' \describe{
#' \item{`id`}{Participant ID.}
#' \item{`time`}{Age of first juvenile arrest.}
#' \item{`age`}{Age each record corresponds to.}
#' \item{`event`}{Binary indicator for whether and when the adolescent was arrested.}
#' \item{`censor`}{Censoring status.}
#' \item{`abused`}{Binary indicator for whether the adolescent was abused.}
#' \item{`black`}{Binary indicator for whether the adolescent is black.}
#' \item{`period`}{Age each record corresponds to.}
#' \item{`event`}{Binary indicator for whether the adolescent was arrested.}
#' }
#' @source
#' Keiley, M. K., & Martin, N. C. (2002). Child abuse, neglect, and juvenile
Expand All @@ -586,11 +581,10 @@ NULL
#'
#' \describe{
#' \item{`id`}{Participant ID.}
#' \item{`last_term`}{The term a student stopped enrolling in mathematics courses.}
#' \item{`woman`}{Binary indicators for whether the student identified as a woman.}
#' \item{`censor`}{Censoring status.}
#' \item{`term`}{Term each record corresponds to.}
#' \item{`term`}{Academic term each record corresponds to.}
#' \item{`event`}{Binary indicator for whether the student stopped enrolling in mathematics courses at a given term.}
#' \item{`censor`}{Censoring status.}
#' \item{`woman`}{Binary indicators for whether the student identified as a woman.}
#' }
#' @source
#' Graham, S. E. (1997). The exodus from mathematics: When and why?
Expand Down
21 changes: 15 additions & 6 deletions data-raw/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -213,17 +213,25 @@ tenure <- tidy_data$tenure_orig |>

first_depression_1 <- tidy_data$depression_pp |>
rename(
depressive_episode = event,
interview_age = age,
censor_age = censage,
siblings = nsibs,
parental_divorce = pd,
parental_divorce_now = pdnow
parental_divorce_now = pdnow,
age = period
) |>
select(-(censor_age:aged), -(sibs12:sibs9plus), -(one:age_18cub))
select(
-c(onset, interview_age),
-(censor_age:aged),
-(sibs12:bigfamily),
-(parental_divorce_now:age_18cub)
) |>
relocate(id, age, event, censor, parental_divorce, female, siblings)

first_arrest <- tidy_data$firstarrest_pp |>
select(-starts_with("d"), -ablack)
select(-time, -starts_with("d"), -ablack) |>
rename(age = period) |>
relocate(id, age, event, censor, abused, black)

math_dropout <- tidy_data$mathdropout_pp |>
rename(
Expand All @@ -232,12 +240,13 @@ math_dropout <- tidy_data$mathdropout_pp |>
last_term = lastpd
) |>
select(
-c(one, ltime, fltime),
-c(last_term, one, ltime, fltime),
-starts_with("hs"),
-starts_with("coll"),
-starts_with("fhs"),
-starts_with("fcoll")
)
) |>
relocate(id, term, event, censor, woman)

# Chapter 13 ------------------------------------------------------------------

Expand Down
Loading

0 comments on commit c1598d8

Please sign in to comment.