View source: R/data_functions.R
create_points | R Documentation |
Produces an sf object with location and time of cases from a data frame
create_points(
data,
pos_vars = c("lat", "long"),
t_var,
format = "%Y-%m-%d",
verbose = TRUE
)
data |
data.frame with the x- and y-coordinate of case locations and the date of the case. |
pos_vars |
vector of length two with the names of the columns containing the y and x coordinates, respectively. |
t_var |
character string with the name of the column with the date of the case. If single-period analysis then set t_var to NULL. |
format |
character string with the format of the date specified by t_var. See strptime |
verbose |
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.
An sf object of the same size as data
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')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.