macroarea: Constructor for object of class 'macroarea'

Description Usage Arguments Value Methods (by generic) Note Examples

View source: R/macroarea.R

Description

The function macroarea() 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
38
39
40
41
42
43
44
45
## S3 method for class 'macroarea'
get_macroregions(x, ...)

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

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

## S3 method for class 'macroarea'
get_all_macroregion(x, ...)

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

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

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

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

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

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

## S3 method for class 'macroarea'
get_initial_time(x, ...)

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

## S3 method for class 'macroarea'
get_final_time(x, ...)

macroarea(name, macroregions,
  initial_strip = get_all_macroregion(macroregions), initial_time = 0L,
  final_time = Inf)

## S3 method for class 'macroarea'
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 macroarea

macroregions

[lst] a list of objects of class region and/or macroregion, passed by set_macroregions(). Note: all the regions and macroregions in a macroarea must be of the same state. Moreover, all regions (alone and into some macroregion) must be different.

initial_strip

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

initial_time

[int] (default is '0') the time in which the macroarea is defined start to be used

final_time

[int] (default is 'Inf', i.e. forever) the time in which the macroarea finish to be used

Value

An object of class macroarea.

Methods (by generic)

Note

Even if improbable, a macroarea can be composed by a single macroregion which can be composed by a single region which can be composed by a single center

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
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('Macroarea Nord',
  macroregions = set_macroregions(piemonte, nitp)
)
get_macroregions(nord)
get_regions(nord)
get_all_region(nord)
get_all_macroregion(nord)
get_state(nord) # "italy"
get_centers(nord)
get_p_accept(nord)
get_offered(nord)
get_initial_strip(nord)
get_current_strip(nord)
get_initial_time(nord)
get_time(nord)
get_final_time(nord)
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

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