create_realistic_org: Create a realistic organisation

Description Usage Arguments Value Examples

Description

Create an organisation where each unit starts with a specified number of child units up until a maximum depth, but where units are then randomly removed according to probabilities set in either a single value for all units, a value per unit depth or a user defined function of depth.

Usage

1
2
create_realistic_org(n_children = 4, max_depth = 3, prob = 0.3,
  .f = NULL, delete_units = TRUE)

Arguments

n_children

number of child units per parent unit (integer)

max_depth

integer maximum depth of organisation (integer)

prob

probability that a unit is deleted to create an irregular organisation. If a vector is provided that is the same length as max_depth then a different probability can be assigned to different levels of the organisation (double or vector of doubles)

.f

function of depth that generates probability that a unit is removed (NOT IMPLEMENTED) (function of x)

delete_units

retains intermediate variables and doesn't delete units - useful to understand how the function is working (logical)

Value

tidygraph object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
set.seed(1234)
tg1a <- create_realistic_org(4,3, prob=0.3)
tg1a

## Not run: 
plot_org(tg1a, fill_var='org_depth')

## End(Not run)

set.seed(1234)
tg1b <- create_realistic_org(4,3, prob=0.3, delete_units=FALSE)
tg1b

## Not run: 
plot_org(tg1b, fill_var='to_delete')

## End(Not run)

set.seed(1234)
tg2a <- create_realistic_org(4,3, prob=c(0.2, 0.4, 0.6))
tg2a
## Not run: 
plot_org(tg2a, fill_var='org_depth')

## End(Not run)

set.seed(1234)
tg2b <- create_realistic_org(4,3, prob=c(0.2, 0.4, 0.6), delete_units=FALSE)
tg2b
## Not run: 
plot_org(tg2b, fill_var='to_delete')

## End(Not run)

ukgovdatascience/orgsurveyr documentation built on May 4, 2019, 7:41 p.m.