travel_data_template: Generalized template for travel data

Description Usage Format Author(s) Examples

Description

This template data frame provides a general structure for travel data that integrates with data synthesis and modeling functions. Stays (individuals reported as not traveling outside home location) are to be included in this data frame, where origin and destination are the same. Note that models fitted and then extrapolated using other data assume that the same method for defining population size is used throughout. Either dates or time span must be filled.

Usage

1

Format

a data frame with empty columns and generalized column names

date_start

date: beginning of the time interval for the trip count

date_stop

date: end of the time interval for the trip count

date_span

integer: time span in days

indiv_id

integer: unique individual identifier

indiv_age

numeric: age of participant

indiv_sex

logical: gender of perticipant

indiv_type

factor: if individual participants belong to different groups

orig_adm0

character: name of highest administration level of origin location (Country)

orig_adm1

character: name of administration level 1 of origin location (e.g. Division, State)

orig_adm2

character: name of administration level 2 of origin location (e.g. District, County)

orig_adm3

character: name of administration level 3 of origin location (e.g. Sub-district, Province)

orig_adm4

character: name of administration level 4 of origin location (e.g. City, Municipality)

orig_adm5

character: name of administration level 5 of origin location (e.g. Town, Village, Community, Ward)

orig_type

character: administrative type for the origin location (e.g. sub-district, community vs town, or urban vs rural)

orig_x

numeric: longitude of origin location centroid in decimal degrees (centroid of smallest admin unit)

orig_y

numeric: latitude of origin location centroid in decimal degrees (centroid of smallest admin unit)

orig_pop

numeric: population size of lowest administrative unit for origin location

dest_adm0

character: name of highest administration level of destination location (Country)

dest_adm1

character: name of administration level 1 of destination location (e.g. Division, State)

dest_adm2

character: name of administration level 2 of destination location (e.g. District, County)

dest_adm3

character: name of administration level 3 of destination location (e.g. Sub-district, Province)

dest_adm4

character: name of administration level 4 of destination location (e.g. City, Municipality)

dest_adm5

character: name of administration level 5 of destination location (e.g. Town, Village, Community, Ward)

dest_type

character: administrative type for the destination location (e.g. sub-district, community vs town, or urban vs rural)

dest_x

numeric: longitude of destination location in decimal degrees (centroid of smallest admin unit)

dest_y

numeric: latitude of destination location centroid in decimal degrees (centroid of smallest admin unit)

dest_pop

numeric: population size of lowest administrative unit for destination location

trips

numeric: total number of observed trips made from origin to destination during time span

Author(s)

John Giles

Examples

  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
#--------------------------------
# Travel among locations
#--------------------------------

trip <- travel_data_template
n <- 3 # Add some observations
trip[1:n,] <- NA

# Time span of travel survey
trip$date_start <- as.Date("2020-01-01")
trip$date_stop <- trip$date_start + 30
trip$date_span <- difftime(trip$date_stop, trip$date_start, units='days')

# Participant info
trip$indiv_id <- sample(1:100, n)
trip$indiv_age <- round(runif(n, 5, 80))
trip$indiv_sex <- rbinom(n, 1, 0.5)

# Origin info
trip$orig_adm0 <- 'A'
trip$orig_adm1 <- 'A'
trip$orig_adm2 <- 'A'
trip$orig_adm3 <- LETTERS[1:n]
trip$orig_type <- 'Sub-district' # Type of admin unit for lowest admin level
trip$orig_x <- rnorm(n, 100, 5)
trip$orig_y <- rnorm(n, 20, 2)
trip$orig_pop <- rpois(n, 10000)

# Destination info
trip$dest_adm0 <- 'A'
trip$dest_adm1 <- 'A'
trip$dest_adm2 <- 'B'
trip$dest_adm3 <- LETTERS[(n+1):(n*2)]
trip$dest_type <- 'Sub-district' # Type of admin unit for lowest admin level
trip$dest_x <- rnorm(n, 100, 5)
trip$dest_y <- rnorm(n, 20, 2)
trip$dest_pop <- rpois(n, 5000)

# Number of reported trips
trip$trips <- rpois(n, 10)

head(trip)



#-----------------------
# Stays in home location
#-----------------------

stay <- travel_data_template
n <- 3 # add some observations
stay[1:n,] <- NA

# Time span of travel survey
stay$date_start <- as.Date("2020-01-01")
stay$date_stop <- stay$date_start + 30
stay$date_span <- difftime(trip$date_stop, trip$date_start, units='days')

# Participant info
stay$indiv_id <- sample(100:200, n)
stay$indiv_age <- round(runif(n, 5, 80))
stay$indiv_sex <- rbinom(n, 1, 0.5)

# Origin info
stay$orig_adm0 <- stay$dest_adm0 <- 'A'
stay$orig_adm1 <- stay$dest_adm1 <- 'A'
stay$orig_adm2 <- stay$dest_adm2 <- 'A'
stay$orig_adm3 <- stay$dest_adm3 <- LETTERS[1:n]
stay$orig_type <- stay$dest_type <- 'Sub-district'
stay$orig_x <- stay$dest_x <- rnorm(n, 100, 5)
stay$orig_y <- stay$dest_y <- rnorm(n, 20, 2)
stay$orig_pop <- stay$dest_pop <- rpois(n, 10000)

stay$trips <- NA

head(stay)

# Combine
survey_data <- dplyr::full_join(trip, stay)
head(survey_data)



#----------------------------------------
# Dataset with which to extrapolate model
#----------------------------------------

pred <- travel_data_template
n <- 6 # Add some observations
pred[1:n,] <- NA

# Time span of the interval over which to extrapolate the fitted model
pred$date_span <- as.difftime(7, units='days')

# Origin info
pred$orig_adm0 <- 'A'
pred$orig_adm1 <- 'A'
pred$orig_adm2 <- LETTERS[1:n]
pred$orig_type <- 'District' # Type of admin unit for lowest admin level
pred$orig_x <- rnorm(n, 100, 5)
pred$orig_y <- rnorm(n, 20, 2)
pred$orig_pop <- rpois(n, 1e+05)

# Number of reported trips (unobserved for extrapolation data)
trip$trips <- NA

head(pred)

COVID-19-Mobility-Data-Network/mobility documentation built on Nov. 22, 2021, 12:17 a.m.