Learn R Programming

behavr (version 0.3.2)

bind_behavr_list: Put together a list of behavr tables

Description

Bind all rows of both data and metadata from a list of behavr tables into a single one. It checks keys, number and names of columns are the same across all data. In addition, it forbids to bind metadata that would result in duplicates (same id in two different metadata).

Usage

bind_behavr_list(l)

Arguments

l

list of behavr

Value

a single behavr object

See Also

  • behavr -- the documentation of the behavr object

Examples

Run this code
# NOT RUN {
met <- data.table::data.table(id = 1:5,
                             condition = letters[1:5],
                             sex = c("M", "M", "M", "F", "F"),
                             key = "id")
data <- met[,list(t = 1L:100L,
                  x = rnorm(100),
                  y = rnorm(100),
                  eating = runif(100) > .5),
                  by = "id"]
d1 <- behavr(data, met)

met[,id := id + 5]
data[,id := id + 5]
data.table::setkeyv(met, "id")
data.table::setkeyv(data, "id")

d2 <- behavr(data, met)
d_all <- bind_behavr_list(list(d1, d2))
print(d_all)
# }

Run the code above in your browser using DataLab