event_locate: Get location event in a calendar variable

Description Usage Arguments Value Examples

View source: R/event_locate.R

Description

Get location event in a calendar variable

Usage

1
2
3
4
5
6
7
8
event_locate(
  calendar,
  event,
  sequences = TRUE,
  recent_oldest = "recent",
  start_end = "start",
  interview = 0
)

Arguments

calendar

string(s) of DHS calendar, months in original order (i.e. recent -> older)

event

code(s) of event of interest (can take regex)

sequences

look for sequence of event - if FALSE individual events [default: TRUE]

recent_oldest

return location most recent or the oldest event in the calendar [default: "recent"]

start_end

return location of the start or the end of the event [default: "start"]

interview

variable of the date of interview [default: 0]

Value

location of the event in the string (recent or older AND start or end)

Examples

1
2
3
4
5
6
7
dat_calendar <- c("3300000BPP", "5000TPP111", "0123005670")
event_locate(dat_calendar, "P")
event_locate(dat_calendar, "P", sequences = FALSE)
event_locate(dat_calendar, 0)
event_locate(dat_calendar, 0, recent_oldest = "oldest")
event_locate(dat_calendar, 0, recent_oldest = "oldest", start_end = "end")
event_locate(dat_calendar, 0, interview = c(0, 10, 100))

trottieralex/DHScalendR documentation built on March 12, 2020, 3:05 a.m.