Combining two years of data

A reprex would be preferable.

    obs.det <- data.frame(obs.detA.two[,c()],obs.detB.two[,c()])

is f(x) = y, where y is desired to be a data frame composed by f = data.frame with x = x_i + x_j.

Each x is a subset of a data frame object composed with the bracket operator function, the arguments to which are row, column.

If, and only if the number of rows and columns is identical in each of those arguments will data.frame compose obs.det.

In the statement, r is omitted, which selects all rows. If the number of rows are unequal, resort can be had to dplyr::add_row to combine the separate x objects, given an equal number of columns.

The second argument, columns can be left blank to select all variables or it can be composed by identifying one, a range, or specific columns, in the latter case using the c operator.

What could go wrong?

  1. Non-existent column identifier
  2. Non-existent range
  3. One or more non-existent columns

If each subset passes the three test, the number of r and c still must be identical. Each can be tested

dim(mtcars[,2])
#> NULL
dim(mtcars[,4:8])
#> [1] 32  5
dim(mtcars[,c(2,4,6,8)])
#> [1] 32  4

Created on 2020-09-15 by the reprex package (v0.3.0)