test_valid_raster_format: Tests if a data frame is in valid raster format

Description Usage Arguments Examples

View source: R/test_valid_NDTr_objects.R

Description

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.

Usage

1

Arguments

raster_data

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# 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))

emeyers/NDTr documentation built on Aug. 8, 2020, 3:41 p.m.