Combining two years of data

Hey everyone,

I hope I can explain this well enough over text. I have been working on occupancy data with beaver for awhile now. Currently, I am trying to run this my data as a multi-season model with package unmarked. I have successfully combined both years observations and occupancy variables (site specific), however I am unable to combine my detection variables (survey specific) together. I get the error "incorrect number of dimensions" which does not make any sense as both years have 44 observations of 5 variables per each covariate (10 covariates each).

Here is the code that works for the occupancy data.
site.CovsA(B).mf is to get the number of sites the same.
site.Covs.mf is A+B converged into one.

#site covariates
colnames(site.CovsA.bis)[1] <- "Site"
colnames(site.CovsB.bis)[1] <- "Site"

common <- which(site.CovsA.bis$Site %in% site.CovsB.bis$Site)
site.CovsA.mf <- site.CovsA.bis[c(common),]

common <- which(site.CovsB.bis$Site %in% site.CovsA.bis$Site)
site.CovsB.mf <- site.CovsB.bis[c(common),]

site.Covs.mf <- data.frame(site.CovsA.mf[,c(2:29)],site.CovsB.mf[,c(2:29)])

Here is what site.Covs.mf looks like:
co tm st co.1 tm.1 st.1
Yes No Yes Yes No Yes
Yes No Yes Yes No Yes

Here is the broken code
obs.det <- data.frame(obs.detA.two[,c()],obs.detB.two[,c()])

This is what that data looks like
R1.dh R2.dh R3.dh R4.dh R5.dh
1 YES YES YES YES YES
2 YES YES YES YES YES

and its structure
List of 10
dh :'data.frame': 44 obs. of 5 variables: .. R1.dh: chr [1:44] "YES" "YES" "YES" "YES" ...

Anyone have any ideas?

> c()
NULL

has NULL dimension

No matter what I put in c() I get the same results. I have tried c(1:50) since I have 50 pieces of data and c(1:10) for each variable. Neither work. I cannot think of any other dimensions it may have.

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)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.