meta: Retrieve and set metadata

Description Usage Arguments Value See Also Examples

View source: R/meta.R

Description

This function returns the metadata from a behavr table.

Usage

1
2
3
meta(x)

setmeta(x, new)

Arguments

x

behavr object

new

a new metadata table

Value

a data.table representing the metadata in x

See Also

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
set.seed(1)
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"]

d <- behavr(data, met)
## show metadata
meta(d)
# same as:
d[meta = TRUE]
## set metadata
m <- d[meta = TRUE]
# only id > 2 is kept
setmeta(d, m[id < 3])
meta(d)

rethomics/behavr documentation built on June 15, 2021, 2:05 p.m.