append_egor: Append rows/columns to ego, alter or aatie data

append_egorR Documentation

Append rows/columns to ego, alter or aatie data

Description

These work like dplyr's bind_cols() and bind_rows(). The first argument has to be an egor object. Additional rows/columns are added bottom/RHS of the active data level (ego, alter, aatie).

Usage

append_rows(.egor, ..., .id = NULL)

append_cols(.egor, ...)

Arguments

.egor

An egor object.

...

Data frames to combine.

.id

Data frame identifier.

Value

egor object containing the additional rows/ columns on the active level.

Examples

e <- make_egor(12, 15)

# Adding a column to the ego level
additional_ego_columns <-
  tibble(x = sample(1:3, 12, replace = TRUE))
  
append_cols(e, additional_ego_columns)

# Adding rows to the ego and alter level
additional_ego_rows <-
  list(
    .egoID = 13,
    sex = "w",
    age = factor("56 - 65"),
    age.years = 60,
    country = "Australia"
  ) %>%
  as_tibble()
  
additional_alter_rows <-
  list(
    .altID = 1:5,
    .egoID = rep(13, 5),
    sex = sample(c("f", "m"), 5, replace = TRUE)
  ) %>%
  as_tibble()
  
append_rows(e, additional_ego_rows) %>%
  activate(alter) %>%
  append_rows(additional_alter_rows)

egor documentation built on March 31, 2023, 11:33 p.m.