Description Usage Arguments Details Value See Also Examples
Set the meta-information stored together with the data.
For most kinds of arguments the WMDS
and
MOPMX
methods set the meta-information
stored together with the measurements for all plates at
once. But they can address the plates individually if
value
is a data frame, and they can address
metadata keys individually if value
is a formula.
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | ## S4 replacement method for signature 'MOPMX,ANY,ANY'
metadata(object, key) <- value
## S4 replacement method for signature 'MOPMX,ANY,data.frame'
metadata(object, key) <- value
## S4 replacement method for signature 'MOPMX,missing,ANY'
metadata(object, key) <- value
## S4 replacement method for signature 'MOPMX,missing,character'
metadata(object, key) <- value
## S4 replacement method for signature 'MOPMX,missing,data.frame'
metadata(object, key) <- value
## S4 replacement method for signature 'MOPMX,missing,logical'
metadata(object, key) <- value
## S4 replacement method for signature 'OPM,missing,character'
metadata(object, key) <- value
## S4 replacement method for signature 'OPM,missing,logical'
metadata(object, key) <- value
## S4 replacement method for signature 'WMD,ANY,ANY'
metadata(object, key) <- value
## S4 replacement method for signature 'WMD,character,ANY'
metadata(object, key) <- value
## S4 replacement method for signature 'WMD,character,WMD'
metadata(object, key) <- value
## S4 replacement method for signature 'WMD,character,WMDS'
metadata(object, key) <- value
## S4 replacement method for signature 'WMD,character,data.frame'
metadata(object, key) <- value
## S4 replacement method for signature 'WMD,list,WMD'
metadata(object, key) <- value
## S4 replacement method for signature 'WMD,list,WMDS'
metadata(object, key) <- value
## S4 replacement method for signature 'WMD,list,data.frame'
metadata(object, key) <- value
## S4 replacement method for signature 'WMD,list,list'
metadata(object, key) <- value
## S4 replacement method for signature 'WMD,missing,FOE'
metadata(object, key) <- value
## S4 replacement method for signature 'WMD,missing,WMD'
metadata(object, key) <- value
## S4 replacement method for signature 'WMD,missing,WMDS'
metadata(object, key) <- value
## S4 replacement method for signature 'WMD,missing,character'
metadata(object, key) <- value
## S4 replacement method for signature 'WMD,missing,data.frame'
metadata(object, key) <- value
## S4 replacement method for signature 'WMD,missing,list'
metadata(object, key) <- value
## S4 replacement method for signature 'WMD,numeric,WMD'
metadata(object, key) <- value
## S4 replacement method for signature 'WMD,numeric,WMDS'
metadata(object, key) <- value
## S4 replacement method for signature 'WMD,numeric,data.frame'
metadata(object, key) <- value
## S4 replacement method for signature 'WMD,numeric,list'
metadata(object, key) <- value
## S4 replacement method for signature 'WMDS,ANY,ANY'
metadata(object, key) <- value
## S4 replacement method for signature 'WMDS,ANY,WMD'
metadata(object, key) <- value
## S4 replacement method for signature 'WMDS,ANY,WMDS'
metadata(object, key) <- value
## S4 replacement method for signature 'WMDS,ANY,data.frame'
metadata(object, key) <- value
## S4 replacement method for signature 'WMDS,character,WMDS'
metadata(object, key) <- value
## S4 replacement method for signature 'WMDS,character,data.frame'
metadata(object, key) <- value
## S4 replacement method for signature 'WMDS,missing,FOE'
metadata(object, key) <- value
## S4 replacement method for signature 'WMDS,missing,WMD'
metadata(object, key) <- value
## S4 replacement method for signature 'WMDS,missing,WMDS'
metadata(object, key) <- value
## S4 replacement method for signature 'WMDS,missing,character'
metadata(object, key) <- value
## S4 replacement method for signature 'WMDS,missing,data.frame'
metadata(object, key) <- value
## S4 replacement method for signature 'WMDS,missing,list'
metadata(object, key) <- value
## S4 replacement method for signature 'WMDS,missing,logical'
metadata(object, key) <- value
|
object |
|
key |
Missing, numeric scalar, character vector, factor, or list.
|
value |
Character vector, list, data frame, formula,
|
This method can easily be used to copy (selected parts
of) the csv_data
to the metadata; see there
for details.
map_metadata
can also be used to modify
metadata but it will return a novel object. See
edit
for manually modifying metadata.
value
.
Other metadata-functions: edit
,
include_metadata
,
map_metadata
, map_values
,
metadata
, metadata_chars
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | ## WMD methods
# WMD/missing/list method
copy <- vaas_1
new.md <- list(Species = "Thermomicrobium roseum")
metadata(copy) <- new.md
stopifnot(identical(metadata(copy), new.md))
# WMD/missing/formula method (operates on previous entries!)
copy <- vaas_1
metadata(copy) <- Organism ~ paste(Species, Strain)
(x <- metadata(copy, "Organism"))
stopifnot(is.null(metadata(vaas_1, "Organism")), !is.null(x))
# WMD/numeric/list method
copy <- vaas_1
metadata(copy, 1) <- list(Authors = "Vaas et al.")
stopifnot(length(metadata(copy)) > length(metadata(vaas_1)))
# WMD/list/list method
copy <- vaas_1
stopifnot(identical(metadata(copy, "Species"), "Escherichia coli"))
# You can use this to translate the keys on-the-fly...
metadata(copy, list(Organism = "Species")) <- list(
Organism = "Bacillus subtilis")
stopifnot(length(metadata(copy)) == length(metadata(vaas_1)))
stopifnot(identical(metadata(copy, "Species"), "Bacillus subtilis"))
stopifnot(is.null(metadata(copy, "Organism"))) # this was not set!
# ...but you need not
metadata(copy, list("Species")) <- list(Species = "Yersinia pestis")
stopifnot(length(metadata(copy)) == length(metadata(vaas_1)))
stopifnot(identical(metadata(copy, "Species"), "Yersinia pestis"))
# Names need not be duplicated
metadata(copy, list("Species")) <- list("Gen. sp.")
stopifnot(length(metadata(copy)) == length(metadata(vaas_1)))
stopifnot(identical(metadata(copy, "Species"), "Gen. sp."))
# ...but this would delete the entry because nothing would be found in
# 'value'
metadata(copy, list("Species")) <- list(Organism = "E. coli")
stopifnot(length(metadata(copy)) < length(metadata(vaas_1)))
stopifnot(is.null(metadata(copy, "Species")))
# ...this yields a general mechanism for metadata deletion by providing an
# empty list as 'value'.
# WMD/character/any method
copy <- vaas_1
metadata(copy, "Strain") <- "08/15"
stopifnot(length(metadata(copy)) == length(metadata(vaas_1)))
stopifnot(metadata(copy, "Strain") != metadata(vaas_1, "Strain"))
# WMD/factor/any method
metadata(copy, as.factor("Strain")) <- metadata(vaas_1, "Strain")
stopifnot(metadata(copy, "Strain") == metadata(vaas_1, "Strain"))
## WMDS methods
# WMDS/missing/list method
copy <- vaas_4
(metadata(copy) <- list(x = -99)) # will replace all of them
stopifnot(identical(unique(metadata(copy)), list(list(x = -99))))
metadata(copy[2]) <- list(x = 1) # will replace those of 2nd plate
stopifnot(identical(unique(metadata(copy)),
list(list(x = -99), list(x = 1))))
# WMDS/missing/WMD method
(metadata(copy) <- vaas_1) # will also replace all of them
stopifnot(identical(unique(metadata(copy)), list(metadata(vaas_1))))
# WMDS/missing/formula method
copy <- vaas_4
metadata(copy) <- Organism ~ paste(Species, Strain)
(x <- metadata(copy, "Organism"))
stopifnot(length(x) == length(metadata(vaas_4, "Organism")) + 4)
# WMDS/ANY/ANY method
copy <- vaas_4
(metadata(copy, "Species") <- "Bacillus subtilis") # will set all of them
stopifnot(identical(unique(metadata(copy, "Species")), "Bacillus subtilis"))
stopifnot(!identical(metadata(copy), metadata(vaas_4)))
metadata(copy) <- vaas_4 # reset
metadata(copy)
stopifnot(identical(metadata(copy), metadata(vaas_4)))
(metadata(copy) <- vaas_1) # set everything to metadata of vaas_1
stopifnot(identical(unique(metadata(copy)), list(metadata(vaas_1))))
# WMDS/character/data frame method
copy <- vaas_4
(x <- data.frame(Type = grepl("T$", metadata(vaas_4, "Strain"))))
metadata(copy, "Type") <- x
# one-column data frames are simplified
stopifnot(identical(metadata(copy, "Type"), x$Type))
# if keys match, a partial selection of the data frame is used
(x <- cbind(x, Notype = !x$Type))
metadata(copy, "Type") <- x
stopifnot(identical(metadata(copy, "Type"), x$Type))
# if keys do not match, the entire data-frame rows are included
metadata(copy, "Type2") <- x
stopifnot(!identical(metadata(copy, "Type2"), x$Type))
# WMDS/missing/character method: setting unique IDs
metadata(copy) <- opm_opt("md.id.name") # set IDs
metadata(copy, opm_opt("md.id.name")) # get these IDs
stopifnot(is.integer(metadata(copy, opm_opt("md.id.name"))))
# to reset the start point to the number n, use opm_opt(md.id.start = n)
# WMDS/missing/character method: setting the running time
metadata(copy) <- opm_opt("md.duration") # set it
metadata(copy, opm_opt("md.duration")) # receive it
stopifnot(is.double(metadata(copy, opm_opt("md.duration"))))
# WMDS/missing/logical method: storing or deleting csv_data() entries
copy <- vaas_4
metadata(copy) <- TRUE # store them
stopifnot(ncol(to_metadata(copy)) > ncol(to_metadata(vaas_4)))
metadata(copy) <- FALSE # remove them again
stopifnot(identical(metadata(copy), metadata(vaas_4)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.