is.data: Check format of data storage (for simulation results or...

View source: R/is_data.R

is.dataR Documentation

Check format of data storage (for simulation results or observations)

Description

Check format of data storage (for simulation results or observations)

Usage

is.data(data_list)

Arguments

data_list

List of values to check

Details

data is expected to be stored in a vector of named list containing for each situation a data.frame with a column "Date" plus one column per variable

Value

TRUE if data_list has the expected format, FALSE otherwise (+ warnings)

Examples


data_list <- list(
  sit1 = data.frame(
    Date = as.POSIXct(c("2009-11-30", "2009-12-10")),
    var1 = c(1.1, 1.5), var2 = c(NA, 2.1)
  ),
  sit2 = data.frame(
    Date = as.POSIXct(c("2009-11-30", "2009-12-5")),
    var1 = c(1.3, 2)
  )
)
CroptimizR:::is.data(data_list)

# Missing Date column
data_list <- list(
  sit1 = data.frame(var1 = c(1.1, 1.5), var2 = c(NA, 2.1)),
  sit2 = data.frame(
    Date = as.POSIXct(c("2009-11-30", "2009-12-5")),
    var1 = c(1.3, 2)
  )
)
CroptimizR:::is.data(data_list)

# Bad Date format
data_list <- list(
  sit1 = data.frame(
    Date = c("2009-11-30", "2009-12-10"),
    var1 = c(1.1, 1.5), var2 = c(NA, 2.1)
  ),
  sit2 = data.frame(Date = c("2009-11-30", "2009-12-5"), var1 = c(1.3, 2))
)
CroptimizR:::is.data(data_list)



SticsRPacks/CroptimizR documentation built on Dec. 16, 2024, 11:54 a.m.