powered by
Produces an sf object with location and time of cases from a data frame
create_points( data, pos_vars = c("lat", "long"), t_var = NULL, format = "%Y-%m-%d", verbose = TRUE )
An sf object of the same size as data
data
data.frame with the x- and y-coordinate of case locations and the date of the case.
vector of length two with the names of the columns containing the y and x coordinates, respectively.
character string with the name of the column with the date of the case. If single-period analysis then set t_var to NULL.
character string with the format of the date specified by t_var. See strptime
Logical indicating whether to print information
Given a data frame containing the point location and date of cases, the function will return an sf object of the points with the date information.
dp <- data.frame(y=runif(10,0,3),x=runif(10,0,3),date=paste0("2021-01-",11:20)) dp <- create_points(dp,pos_vars = c('y','x'),t_var='date')
Run the code above in your browser using DataLab