This function takes a data frame and tests that the data frame is in valid raster format by checking that the data frame contains variables with the appropriate names. If the data frame is not in correct raster format, an error will be thrown that contains a message why the data is not in valid raster format.

test_valid_raster_format(raster_data)

Arguments

raster_data

A data frame that will be checked to see if it is in valid raster format.

Examples

# This is valid raster data so the function will return no error message raster_dir_name <- file.path( system.file("extdata", package = "NDTr"), "Zhang_Desimone_7object_raster_data_rda" ) file_name <- "bp1001spk_01A_raster_data.rda" raster_full_path <- file.path(raster_dir_name, file_name) test_valid_raster_format(raster_full_path) # Binned data is not in raster format (it has an extra column called siteID) so # checking if it is in raster format should return an error. binned_file_name <- system.file("extdata/ZD_150bins_50sampled.Rda", package = "NDTr") try(test_valid_raster_format(binned_file_name))
#> Error in test_valid_raster_format(binned_file_name) : #> Data not in valid raster format: raster data must only contain variables names that start with 'labels.' 'time.', 'site_info.' or 'trial_number'. The following are not valid variable names to have in data that is in raster format: siteID