addProperty: Add and initialize dataframe column

Description Usage Arguments Value Methods (by class) Author(s)

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

1
2
3
4
5
6
7
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)

Author(s)

stravsmi


RMassBank documentation built on Nov. 8, 2020, 6:06 p.m.