Learn R Programming

oce (version 1.7-2)

oceRenameData: Rename Something in an oce data Slot

Description

Rename an item within the data slot of an '>oce object, also changing dataNamesOriginal in the metadata slot, so that the [[ accessor will still work with the original name that was stored in the data.

Usage

oceRenameData(object, old, new, note = "")

Arguments

object

an '>oce object.

old

character value that matches the name of an item in object's data slot.

new

character value to be used as the new name that matches the name of an item in object's data slot. Thus must not be the name of something that is already in the data slot. If new is the same as old, then the object is returned unaltered.

note

character value that holds an explanation of the reason for the change. If this is a string of non-zero length, then this is inserted in the processing log of the returned value. If it is NULL, then no entry is added to the processing log. Otherwise, the processing log gets a new item that is constructed from the function call.

See Also

Other things related to the data slot: oceDeleteData(), oceGetData(), oceSetData()

Examples

Run this code
# NOT RUN {
library(oce)
data(ctd)
CTD <- oceRenameData(ctd, "salinity", "SALT")
stopifnot(all.equal(ctd[["salinity"]], CTD[["SALT"]]))
stopifnot(all.equal(ctd[["sal00"]], CTD[["SALT"]]))

# }

Run the code above in your browser using DataLab