duplicated {opm}R Documentation

Determine duplicated plates

Description

Check whether some, or duplicated, OPM objects are contained within an OPMS object, or whether OPMX objects are contained within an MOPMX object. For reasons of consistency, the OPM methods always returns FALSE or 0. Alternatively, query OPMX objects with other such objects.

Usage

  ## S4 method for signature 'MOPMX,ANY'
anyDuplicated(x, incomparables, ...) 
  ## S4 method for signature 'MOPMX,missing'
anyDuplicated(x, incomparables, ...)
  ## S4 method for signature 'OPM,ANY'
anyDuplicated(x, incomparables, ...) 
  ## S4 method for signature 'OPM,missing'
anyDuplicated(x, incomparables, ...)
  ## S4 method for signature 'OPMS,ANY'
anyDuplicated(x, incomparables, ...) 
  ## S4 method for signature 'OPMS,missing'
anyDuplicated(x, incomparables, ...)

  ## S4 method for signature 'MOPMX,MOPMX'
contains(object, other, ...) 
  ## S4 method for signature 'MOPMX,OPMX'
contains(object, other, ...) 
  ## S4 method for signature 'OPM,OPM'
contains(object, other, ...) 
  ## S4 method for signature 'OPM,OPMS'
contains(object, other, ...) 
  ## S4 method for signature 'OPMS,OPM'
contains(object, other, ...) 
  ## S4 method for signature 'OPMS,OPMS'
contains(object, other, ...) 
  ## S4 method for signature 'OPMX,MOPMX'
contains(object, other, ...) 

  ## S4 method for signature 'MOPMX,ANY'
duplicated(x, incomparables,
    what = c("all", "plate.type", "metadata"), exact = TRUE, strict = FALSE,
    ...) 
  ## S4 method for signature 'MOPMX,missing'
duplicated(x, incomparables, ...) 
  ## S4 method for signature 'OPM,ANY'
duplicated(x, incomparables, ...) 
  ## S4 method for signature 'OPM,missing'
duplicated(x, incomparables, ...) 
  ## S4 method for signature 'OPMS,ANY'
duplicated(x, incomparables,
    what = c("all", "csv", "metadata"), exact = TRUE, strict = FALSE, ...) 
  ## S4 method for signature 'OPMS,missing'
duplicated(x, incomparables, ...) 

Arguments

x

OPMX or MOPMX object.

incomparables

Vector passed to duplicated from the base package. By default this is FALSE.

what

Indicating which parts of x should be compared. If a character scalar, the following entries are special:

all

Compares entire OPM objects.

csv

Compares the CSV data entries setup_time and position (see csv_data). Not for MOPMX objects.

metadata

Compares the entire metadata content.

plate.type

Compares the plate types (only for MOPMX objects).

If what does not match any of these, or is not a character scalar at all, it is passed as key argument to metadata, and the resulting metadata subsets are compared. The following two arguments are only relevant in this case.

exact

Logical scalar passed to metadata.

strict

Logical scalar passed to metadata.

...

Optional arguments passed to duplicated from the base package. For contains, optional arguments passed to identical from the base package, allowing for fine-control of identity.

object

OPMX object.

other

For the OPMX method of contains, an OPMX object used as query.

Details

The OPMS and OPM methods of contains test, for instance, whether an OPM object is contained in an OPMS object. The length of the resulting logical vector is the length of other.

Value

Logical vector in the case of duplicated, integer scalar in the case of anyDuplicated. 0 if no values are duplicated, the index of the first or last (depending on fromLast) duplicated object otherwise. contains returns a logical vector.

See Also

base::duplicated base::anyDuplicated base::identical

Other getter-functions: aggr_settings, aggregated, anyNA, csv_data, dim, disc_settings, discretized, has_aggr, has_disc, hours, max, measurements, minmax, seq, subset, thin_out, well

Examples

# 'OPM' methods
(x <- duplicated(vaas_1)) # 1 element => nothing duplicated
## [1] FALSE
stopifnot(identical(x, FALSE))

(x <- anyDuplicated(vaas_1))
## [1] 0
stopifnot(identical(x, 0L)) # no complete plate duplicated
(x <- anyDuplicated(vaas_1, what = list("Strain", "Species")))
## [1] 0
stopifnot(identical(x, 0L)) # no organisms duplicated

# 'OPMS' methods
stopifnot(!duplicated(vaas_4)) # => no complete plates duplicated
stopifnot(!duplicated(vaas_4, what = list("Species", "Strain")))
# => no organisms duplicated
stopifnot(duplicated(vaas_4, what = "Species") == rep(c(FALSE, TRUE), 2))
# => species duplicated
x <- vaas_4[c(1, 1)] # => complete plate duplicated
stopifnot(c(FALSE, TRUE) == duplicated(x))

stopifnot(identical(anyDuplicated(vaas_4), 0L))
stopifnot(identical(anyDuplicated(vaas_4, what = list("Strain")), 0L))
# => no strains duplicated
stopifnot(identical(anyDuplicated(vaas_4, what = list("Species")), 2L))
# => species duplicated
x <- vaas_4[c(1, 1)] # complete plate duplicated
stopifnot(identical(anyDuplicated(x), 2L))

## contains: 'OPMS'/'OPM' methods
(x <- contains(vaas_4, vaas_4[3])) # single one contained
## [1] TRUE
stopifnot(length(x) == 1, x)
(x <- contains(vaas_4, vaas_4))
## [1] TRUE TRUE TRUE TRUE
stopifnot(length(x) == 4, x) # all contained
(x <- contains(vaas_4[3], vaas_4)) # one of four contained
## [1] FALSE FALSE  TRUE FALSE
stopifnot(length(x) == 4, sum(x) == 1)
stopifnot(contains(vaas_4[3], vaas_4[3])) # identical OPM objects
stopifnot(!contains(vaas_4[3], vaas_4[2])) # non-identical OPM objects

[Package opm version 1.3.63 Index]