This function checks if the provided tiff file is corrupted by attempting to
describe it using the terra
package and searching for the presence of a
"Driver" string in the description, which indicates a valid tiff file. If the
string is found, the function returns TRUE
and FALSE
otherwise.
Value
Logical; returns TRUE
if the tiff file is not corrupted (i.e., it
can be described and contains "Driver" in its description), and FALSE
otherwise.
Examples
(f <- system.file("ex/elev.tif", package="terra"))
#> [1] "/home/runner/work/_temp/Library/terra/ex/elev.tif"
CheckTiff(x = f)
#> [1] TRUE