state: Constructor for object of class 'state'

Description Usage Arguments Value Methods (by generic) Examples

View source: R/state.R

Description

The function state() is the constructor function for the homonymous class.

Usage

 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
34
35
36
37
## S3 method for class 'state'
get_macroareas(x, ...)

## S3 method for class 'state'
get_macroregions(x, ...)

## S3 method for class 'state'
get_regions(x, ...)

## S3 method for class 'state'
get_all_region(x, ...)

## S3 method for class 'state'
get_state(x, ...)

## S3 method for class 'state'
get_centers(x, ...)

## S3 method for class 'state'
get_p_accept(x, ...)

## S3 method for class 'state'
get_offered(x, ...)

## S3 method for class 'state'
get_initial_strip(x, ...)

## S3 method for class 'state'
get_current_strip(x, ...)

## S3 method for class 'state'
get_time(x, ...)

state(name, macroareas, initial_strip = get_all_macroarea(macroareas))

## S3 method for class 'state'
print(x, ...)

Arguments

x

an object used to select a method.

...

further arguments passed to or from other methods.

name

[chr] the name of the state

macroareas

[lst] a list of objects of class macroarea, passed by set_macroareas(). Note: all the macroarea in a state must be of the same state (obviously).

initial_strip

[chr] a sequence of macroareas' names in the state representing the order in which organs started to be distributed in the state at the beginning of the period. All the listed areas have to be included also in the macroareas field. Exculsions are permitted but repetitions are not admitted. (default is the sequence in which areas has been included in the argument macroareas)

Value

An object of class state.

Methods (by generic)

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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
pavia     <- center('Pavia',   'Lombardia', offered = 5, p_accept = 0.6)
bergamo   <- center('Bergamo', 'Lombardia', 8)
milano    <- center('Milano',  'Lombardia', 10, 0.8)
lombardia <- region(set_centers(pavia, bergamo, milano), default_p = 0.7)

padova <- center('Padova', 'Veneto', 8, 0.7)
veneto <- region(set_centers(padova))

nitp <- macroregion('NITp', regions = set_regions(lombardia, veneto),
                    initial_strip = c('lombardia', 'lombardia', 'veneto')
)

torino   <- center('Torino', 'Piemonte', 7, 0.6)
piemonte <- region(set_centers(torino))

nord <- macroarea('Macroarea Nord',
                  macroregions = set_macroregions(piemonte, nitp)
)

roma  <- center('Roma', 'Lazio', 10, 0.9)
lazio <- region(set_centers(roma))
sud   <- macroarea('Macroarea Sud', macroregions = set_macroregions(lazio))

italy <- state('Italy', set_macroareas(nord, sud))
get_macroareas(italy)
get_macroregions(italy)
get_regions(italy)
get_all_region(italy)
get_state(italy) # "italy"
get_centers(italy)
get_p_accept(italy)
get_offered(italy)
get_initial_strip(italy)
get_current_strip(italy)
get_time(italy)
pavia   <- center('Pavia',   'Lombardia', offered = 5, p_accept = 0.6)
pavia

bergamo <- center('Bergamo', 'Lombardia', 8)
milano  <- center('Milano',  'Lombardia', 10, 0.8)

lombardia <- region(set_centers(pavia, bergamo, milano), default_p = 0.7)
lombardia

padova <- center('Padova', 'Veneto', 8, 0.7)
veneto <- region(set_centers(padova))

nitp <- macroregion('NITp', regions = set_regions(lombardia, veneto),
  initial_strip = c('lombardia', 'lombardia', 'veneto')
)
nitp

torino   <- center('Torino', 'Piemonte', 7, 0.6)
piemonte <- region(set_centers(torino))

nord <- macroarea('Nord',
  macroregions = set_macroregions(piemonte, nitp)
)
nord

roma   <- center('Roma', 'Lazio', 10, 0.9)
lazio  <- region(set_centers(roma))

sud <- macroarea('Sud',
  macroregions = set_macroregions(lazio)
)
sud

italy <- state('Italy',
  macroareas = set_macroareas(nord, sud)
)
italy

UBESP-DCTV/clumpr documentation built on July 3, 2021, 11:23 p.m.