mergeRows: Function to Merge Rows of Two Data Frames.

Description Usage Arguments Value Author(s) See Also Examples

View source: R/mergeRows.R

Description

This function merges two data frames by combining their rows.

Usage

1
2
3
4
mergeRows(X, Y, common.only = FALSE, ...)

## S3 method for class 'data.frame'
mergeRows(X, Y, common.only = FALSE, ...)

Arguments

X

First data frame.

Y

Second data frame.

common.only

If TRUE, only variables (columns) common to the two data frame are included in the merged data set; the default is FALSE.

...

Not used.

Value

A data frame containing the rows from both input data frames.

Author(s)

John Fox

See Also

For column merges and more complex merges, see merge.

Examples

1
2
3
4
5
6
7
8
if (require(car)){
    data(Duncan)
    D1 <- Duncan[1:20,]
    D2 <- Duncan[21:45,]
    D <- mergeRows(D1, D2)
    print(D)
    dim(D)
}

Example output

Loading required package: car
Loading required package: carData
Loading required package: sandwich
                   type income education prestige
accountant         prof     62        86       82
pilot              prof     72        76       83
architect          prof     75        92       90
author             prof     55        90       76
chemist            prof     64        86       90
minister           prof     21        84       87
professor          prof     64        93       93
dentist            prof     80       100       90
reporter             wc     67        87       52
engineer           prof     72        86       88
undertaker         prof     42        74       57
lawyer             prof     76        98       89
physician          prof     76        97       97
welfare.worker     prof     41        84       59
teacher            prof     48        91       73
conductor            wc     76        34       38
contractor         prof     53        45       76
factory.owner      prof     60        56       81
store.manager      prof     42        44       45
banker             prof     78        82       92
bookkeeper           wc     29        72       39
mail.carrier         wc     48        55       34
insurance.agent      wc     55        71       41
store.clerk          wc     29        50       16
carpenter            bc     21        23       33
electrician          bc     47        39       53
RR.engineer          bc     81        28       67
machinist            bc     36        32       57
auto.repairman       bc     22        22       26
plumber              bc     44        25       29
gas.stn.attendant    bc     15        29       10
coal.miner           bc      7         7       15
streetcar.motorman   bc     42        26       19
taxi.driver          bc      9        19       10
truck.driver         bc     21        15       13
machine.operator     bc     21        20       24
barber               bc     16        26       20
bartender            bc     16        28        7
shoe.shiner          bc      9        17        3
cook                 bc     14        22       16
soda.clerk           bc     12        30        6
watchman             bc     17        25       11
janitor              bc      7        20        8
policeman            bc     34        47       41
waiter               bc      8        32       10
[1] 45  4

RcmdrMisc documentation built on Aug. 13, 2020, 9:06 a.m.