checkRasclass: Check rasclass object for internal consistency

Description Usage Arguments See Also Examples

View source: R/checkRasclass.R

Description

This function checks wether a rasclass-class object is internally consistent.

Usage

1
checkRasclass(object)

Arguments

object

A rasclass object.

See Also

rasclass-package, rasclass-class, rasclassRaster-class,

readRaster, writeRaster,

readRasterFolder, setRasclassData,

buildFormula,

rasclassMlc, classifyRasclass

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Instanciate rasclass object
object <- new('rasclass')

# Create artificial data
# For this example, create artificial data
mysample <- c(rep(rep(c(1,2), each = 25), 25), rep(rep(c(3,4), each = 25), 25))
mysample <- mysample + sample(c(0, NA), 2500, replace = TRUE, prob = c(1, 10))
myvar1 <- rep(1:50, each = 50) + rnorm(2500, 0, 5)
myvar2 <- rep(rep(1:50), 50) + rnorm(2500, 0, 5)
newdata <- data.frame(mysample, myvar1, myvar2)

# Prepare a rasclass object using the dataframe and specifying raster properties
object <- new('rasclass')
object <- setRasclassData(newdata, ncols = 50, nrows = 50,
	xllcorner = 0, yllcorner = 0, cellsize = 1, NAvalue = -9999,
	samplename = 'mysample')

# The object passes the test at this point
checkRasclass(object)

# Manually change some values number of rows to an inconsitent value
object@gridSkeleton@nrows <- 12345
object@samplename <- 'wrongName'

# The rasclass object now fails the test
checkRasclass(object)

rasclass documentation built on May 2, 2019, 6:11 a.m.