View source: R/spacetime-cube-complete.R
complete_spacetime_cube | R Documentation |
Given a spacetime object, convert it to a spacetime cube. A spacetime cube ensures that there is a regular time-series for each geometry present.
complete_spacetime_cube(x, ...)
x |
a spacetime object. |
... |
unused |
If observations are missing for a time period and location combination, columns will be populated with NAs.
See is_spacetime_cube()
for more details on spacetime cubes.
A spacetime object that meets the criteria of spacetime cube.
df_fp <- system.file("extdata", "bos-ecometric.csv", package = "sfdep") geo_fp <- system.file("extdata", "bos-ecometric.geojson", package = "sfdep") # read in data df <- read.csv(df_fp, colClasses = c("character", "character", "integer", "double", "Date")) geo <- sf::st_read(geo_fp) # Create spacetime object called `bos` bos <- spacetime(df, geo, .loc_col = ".region_id", .time_col = "time_period") # create a sample of data set.seed(0) sample_index <- sample(1:nrow(bos), nrow(bos) * 0.95) incomplete_spt <- bos[sample_index,] # check to see if is spacetime cube is_spacetime_cube(incomplete_spt) # complete it again complete_spacetime_cube(incomplete_spt)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.