knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Specific test functions

Load the koboLoops Package

library("koboloops")

Example data frame

Here we create some fake data for illustration purposes. It is not important to understand this; we keep it in so you can run the example yourself if you like. There are two datasets.

The parent one contains:

The child contains:

parent <- data.frame(uuid=1:10, age_parent=sample(30:60,10,replace = T),parent_gender=sample(c("F","M"),10,replace = T))

child <- data.frame(parent_uuid=sample(1:10,20,replace = T), age_child=sample(1:18,20,replace=T), child_gender=sample(c("F","M"),20,replace = T))

Affect parent age to each child

family <- add_parent_to_loop(child,parent,uuid.name.loop = "parent_uuid",uuid.name.parent = "uuid",c("age_parent"))
family

run ?add_parent_to_loop for details.

Affect all parent information to each child

We affect to the parent the average ages of the children.

variable.to.add = c(mean_of_child_age="age_child")
family <- affect_loop_to_parent(child, parent,aggregate.function = mean , variable.to.add)
family

run ?affect_loop_to_parent for details.



sharonorengo/koboloops documentation built on June 30, 2019, 10:56 a.m.