na.omit

0th

Percentile

Handle Missing Values in Objects

These methods are useful for dealing with NAs in e.g., source_spct, response_spct, filter_spct and reflector_spct.

Usage
# S3 method for generic_spct
na.omit(object, na.action = "omit", fill = NULL, target.colnames, ...)

# S3 method for source_spct na.omit(object, na.action = "omit", fill = NULL, ...)

# S3 method for response_spct na.omit(object, na.action = "omit", fill = NULL, ...)

# S3 method for filter_spct na.omit(object, na.action = "omit", fill = NULL, ...)

# S3 method for reflector_spct na.omit(object, na.action = "omit", fill = NULL, ...)

# S3 method for object_spct na.omit(object, na.action = "omit", fill = NULL, ...)

# S3 method for cps_spct na.omit(object, na.action = "omit", fill = NULL, ...)

# S3 method for raw_spct na.omit(object, na.action = "omit", fill = NULL, ...)

# S3 method for chroma_spct na.omit(object, na.action = "omit", fill = NULL, ...)

# S3 method for generic_mspct na.omit(object, na.action = "omit", fill = NULL, ...)

# S3 method for generic_spct na.exclude(object, na.action = "exclude", fill = NULL, target.colnames, ...)

# S3 method for source_spct na.exclude(object, na.action = "exclude", fill = NULL, ...)

# S3 method for response_spct na.exclude(object, na.action = "exclude", fill = NULL, ...)

# S3 method for filter_spct na.exclude(object, na.action = "exclude", fill = NULL, ...)

# S3 method for reflector_spct na.exclude(object, na.action = "exclude", fill = NULL, ...)

# S3 method for object_spct na.exclude(object, na.action = "exclude", fill = NULL, ...)

# S3 method for cps_spct na.exclude(object, na.action = "exclude", fill = NULL, ...)

# S3 method for raw_spct na.exclude(object, na.action = "exclude", fill = NULL, ...)

# S3 method for chroma_spct na.exclude(object, na.action = "exclude", fill = NULL, ...)

# S3 method for generic_mspct na.exclude(object, na.action = "exclude", fill = NULL, ...)

Arguments
object

an R object

na.action

character One of "omit", "exclude" or "replace".

fill

numeric Value used to replace NAs unless NULL, in which case interpolation is attempted.

target.colnames

character Vector of names for the target columns to operate upon, if present in object.

...

further arguments other special methods could require

Details

If na.omit removes cases, the row numbers of the cases form the "na.action" attribute of the result, of class "omit".

na.exclude differs from na.omit only in the class of the "na.action" attribute of the result, which is "exclude".

Note

na.fail and na.pass do not require a specialisation for spectral objects. R's definitions work as expected with no need to override them. We do not define a method na.replace, just pass "replace" as argument. The current implementation replaces by interpolation only individual NAs which are flanked on both sides by valid data. Runs of multiple NAs con only replaced by a constant value passed through parameter fill.

See Also

na.fail and na.action

Aliases
  • na.omit
  • na.omit.generic_spct
  • na.omit.source_spct
  • na.omit.response_spct
  • na.omit.filter_spct
  • na.omit.reflector_spct
  • na.omit.object_spct
  • na.omit.cps_spct
  • na.omit.raw_spct
  • na.omit.chroma_spct
  • na.omit.generic_mspct
  • na.exclude.generic_spct
  • na.exclude.source_spct
  • na.exclude.response_spct
  • na.exclude.filter_spct
  • na.exclude.reflector_spct
  • na.exclude.object_spct
  • na.exclude.cps_spct
  • na.exclude.raw_spct
  • na.exclude.chroma_spct
  • na.exclude.generic_mspct
Examples
# NOT RUN {
my_sun.spct <- sun.spct
my_sun.spct[3, "s.e.irrad"] <- NA
my_sun.spct[5, "s.q.irrad"] <- NA

head(my_sun.spct)

# rows omitted
zo <- na.omit(my_sun.spct)
head(zo)
na.action(zo)

# rows excluded
ze <- na.exclude(my_sun.spct)
head(ze)
na.action(ze)

# data in both rows replaced
zr <- na.omit(my_sun.spct, na.action = "replace")
head(zr)
na.action(zr)

# }
Documentation reproduced from package photobiology, version 0.9.30, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.