Copy Columns(s) from a Dataset to Another Dataset

DESCRIPTION:

Copies a column (or columns) from a 1- or 2-dimensional dataset to another 1- or 2-dimensional dataset.

USAGE:

copy.col(target, target.start.col, source=<<see below>>, 
         source.col.spec=<<see below>>, overwrite=F) 

REQUIRED ARGUMENTS:

target
1- or 2-dimensional dataset to which the column(s) will be copied. A 1-dimensional dataset is considered to be a single, unnamed column.
target.start.col
integer or character (name-matching) value specifying the column of target to which the copy is to be done. For 2-dimensional datasets, to specify the last column of target plus one, use "@END", "", or a character value not matching any of the column names of target; in the latter case, target.start.col will be used for the name(s) of the copied column(s).

OPTIONAL ARGUMENTS:

source
1- or 2-dimensional dataset from which the column(s) will be copied. A 1-dimensional dataset is considered to be a single, unnamed column. The default is target.
source.col.spec
logical, integer, or character (name-matching) vector specifying the column(s) of source which is/are to be copied. To specify all columns of source, use "@ALL" or ""; to specify the last column of source, use "@END" or "". The default is "@ALL". Only one column may be specified if target is a 1-dimensional dataset.
overwrite
logical flag: if TRUE, the existing column(s) of target will be overwritten by the copied column(s); if FALSE, all existing columns of target (if any) from target.start.col to the last column will be shifted by the number of columns as determined by source.col.spec. overwrite must be TRUE if target is a 1-dimensional dataset.

VALUE:

The target dataset with the copied column(s). For 2-dimensional datasets, the name(s) of the copied column(s) will be the name(s) of the source.col.spec column(s) of source, unless overridden by target.start.col.

SEE ALSO:

, , , , .

EXAMPLES:

# copy from a 1-dimensional dataset to a 2-dimensional dataset 
steam.xy <- copy.col(steam.x, "Usage", steam.y, 1) 
# copy from a 2-dimensional dataset to a 1-dimensional dataset 
steam.y <- copy.col(steam.y, 1, steam.x, "Wind Mph", T)