Learn R Programming

reproducible (version 3.2.1)

fixErrors: Do some minor error fixing

Description

fixErrors --> fixErrosTerra

See writeTo()

Usage

fixErrors(
  x,
  objectName,
  attemptErrorFixes = TRUE,
  useCache = getOption("reproducible.useCache", FALSE),
  verbose = getOption("reproducible.verbose", 1),
  testValidity = getOption("reproducible.testValidity", TRUE),
  ...
)

# S3 method for default fixErrors( x, objectName, attemptErrorFixes = TRUE, useCache = getOption("reproducible.useCache", FALSE), verbose = getOption("reproducible.verbose", 1), testValidity = getOption("reproducible.testValidity", TRUE), ... )

writeOutputs( x, ..., overwrite = getOption("reproducible.overwrite", NULL), verbose = getOption("reproducible.verbose", 1) )

# S3 method for default writeOutputs( x, ..., overwrite = getOption("reproducible.overwrite", FALSE), verbose = getOption("reproducible.verbose", 1) )

Value

A GIS file (e.g., RasterLayer, SpatRaster etc.) that has been attempted to be fixed, if it finds errors.

A GIS file (e.g., SpatRaster etc.) that has been appropriately written to disk. In the case of vector datasets, this will be a side effect. In the case of gridded objects (Raster*, SpatRaster), the object will have a file-backing.

Arguments

x

The object save to disk i.e., write outputs

objectName

Optional. This is only for messaging; if provided, then messages relayed to user will mention this.

attemptErrorFixes

Will attempt to fix known errors. Currently only some failures for SpatialPolygons* are attempted. Notably with terra::buffer(..., width = 0). Default TRUE, though this may not be the right action for all cases.

useCache

Logical, default getOption("reproducible.useCache", FALSE), whether Cache is used on the internal terra::buffer command.

verbose

Numeric, -1 silent (where possible), 0 being very quiet, 1 showing more messaging, 2 being more messaging, etc. Default is 1. Above 3 will output much more information about the internals of Caching, which may help diagnose Caching challenges. Can set globally with an option, e.g., options('reproducible.verbose' = 0) to reduce to minimal

testValidity

Logical. If TRUE, the a test for validity will happen before actually running buffering (which is the solution in most cases). However, sometimes it takes longer to test for validity than just buffer without testing (there are no consequences of buffering if everything is valid). If FALSE, then the test will be skipped and the buffering will happen regardless. If NA, then all testing and buffering will be skipped.

...

Passed into writeTo()

overwrite

Logical. Should file being written overwrite an existing file if it exists.

Author

Eliot McIntire and Jean Marchal

See Also

fixErrorsIn(), postProcessTo(), postProcess()

Examples

Run this code
if (requireNamespace("terra", quietly = TRUE)) {
  r <- terra::rast(terra::ext(0, 100, 0, 100), vals = 1:1e2)

  tf <- tempfile(fileext = ".tif")
  writeOutputs(r, tf)
}

Run the code above in your browser using DataLab