Learn R Programming

CAWaR (version 0.0.2)

compareLabel: compareLabel

Description

Identifies samples that potentially require class label corrections.

Usage

compareLabel(x, y, x.label, y.label, na.count = 0, max.length = 0)

Arguments

x

Object of class data.frame with target profiles.

y

Object of class data.frame with reference profiles.

x.label

Character vector with classes of x.

y.label

Character vector with classes of y.

na.count

Maximum number of NA values accepted.

max.length

Maximum length of consecutive NA values accepted.

Value

A list.

Details

The function cross-correlates x and y. Then,for each row, the function returns the element in y.label with the highest correlation. The final output of the function consists:

  • cross.cor - Median, minimum and maximum values for each column in x over each unique class in y.

  • label.compare - data.frame showing y.label and the best match in y.label.

  • na.stats - data.frame showing the count and maximum number of consecutive NA values for each row in x.

Note that na.count and max.length determine which observations are judged. If These thresholds are exceeded, the function will return NA.

See Also

extractTS analyseTS

Examples

Run this code
# NOT RUN {
{

require(raster)
require(fieldRS)

# read raster data
r <- brick(system.file("extdata", "ndvi.tif", package="fieldRS"))

# read field data
data(fieldData)
data(fieldDataTS)

a.ts <- analyseTS(as.data.frame(fieldDataTS$weighted.mean), fieldData$crop)

# extract reference profiles
rp <- as.data.frame(do.call(rbind, lapply(a.ts$y.statistics, function(i) {i$median})))

# compare labels
cl <- compareLabel(as.data.frame(fieldDataTS$weighted.mean), rp, fieldData$crop, a.ts$labels)

}
# }

Run the code above in your browser using DataLab