Move Row(s) from a Dataset to Another Dataset

DESCRIPTION:

Moves a row (or rows) from a 1- or 2-dimensional dataset to another 1- or 2-dimensional dataset.

USAGE:

move.row(target, target.start.row, source=<<see below>>, 
         source.row.spec=<<see below>>, overwrite=F) 

REQUIRED ARGUMENTS:

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

OPTIONAL ARGUMENTS:

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

VALUE:

The target dataset with the moved row(s). The name(s) of the moved row(s) will be the name(s) of the source.row.spec row(s) of source, unless overridden by target.start.row .

WARNING:

target and source must have compatible rows (the same number of columns, and the same data type in all corresponding columns); otherwise, an error will occur.

SIDE EFFECTS:

The source dataset will have its source.row.spec row(s) removed.

SEE ALSO:

, , , , , .

EXAMPLES:

fuel.shrink <- move.row(fuel.frame, 
                        index.rowcol(fuel.frame,Type=="Small",which="rows")[1], 
                        source.row.spec="Honda Civic CRX Si 4")