addProperty {RMassBank} | R Documentation

## Add and initialize dataframe column

### Description

Adds a new column of a defined type to a `data.frame` and initializes it to a value. The advantage of doing this over adding it with `$` or `[,""]` is that the case `nrow(o) == 0` is adequately handled and doesn't raise an error.

### Usage

    addProperty(o, name, type, value = NA)

    ## S4 method for signature 'RmbSpectrum2,character,character'
    addProperty(o, name, type, value = NA)

    ## S4 method for signature 'data.frame,character,character'
    addProperty(o, name, type, value = NA)

### Arguments

`o` | `data.frame` to add the column to
`name` | Name of the new column
`type` | Data type of the new column
`value` | Initial value of the new column (`NA` if not given)

### Value

Expanded data frame.

### Methods (by class)

- `o = RmbSpectrum2,name = character,type = character`: Add a new column to the RmbSpectrum2 properties

- `o = data.frame,name = character,type = character`: Add a new column to a data.frame

### Author(s)

stravsmi

[Package RMassBank version 3.0.0 Index]