Learn R Programming

egor (version 1.24.2)

comp_ply: Calculate custom compositional measures on an egor object

Description

comp_ply() applies a function, that uses an alter attribute to calculate a compositional measurement, on all networks in an egor object and returns a numeric vector.

Usage

comp_ply(object, alt.attr, .f, ..., ego.attr = NULL, result.name = "result")

Value

A tibble with the ego ID and a numeric result vector.

Arguments

object

An egor object.

alt.attr

A character naming the variable containing the alter-attribute.

.f

A function that returns a numeric.

...

Optional arguments to .f.

ego.attr

Optional character naming an ego attribute.

result.name

Optional character naming the result column.

Author

Michał Bojanowski, michal2992@gmail.com

Till Krenz, egor@tillt.net

Details

When an ego attribute is used the .f is called like this: .f(alt.attr, ego.attr, ...). .f must return a single numeric value.

Examples

Run this code
df <- make_egor(10, 32)
comp_ply(df, "age.years", sd, na.rm = TRUE)

Run the code above in your browser using DataLab