Description Usage Arguments See Also Examples
View source: R/attribute_container.R
Create an attribute container object representing arbitrary values or values from a scale (factor variable) based on a numeric vector, change single values of the container and transform it back into a numeric vector.
A scale attribute container has to be chosen for individual dependent variables in stochastic actor-oriented models (SAOMs) for behavior change. A normal attribute container can be chosen to represent independent individual variables in SAOMs.
1 2 3 4 5 6 7 8 9 10 | create_attribute_container(numericVector)
create_scale_attribute_container(numericVector, min = 0, max = 1, by = 1)
set_value(attributeContainer, i, value)
attribute_container_as_list(attributeContainer)
## S3 method for class 'NetSimAttributeContainer'
as.numeric(x, ...)
## S3 method for class 'NetSimAttributeContainer'
as.double(x, ...)
## S3 method for class 'NetSimAttributeContainer'
print(x, ...)
|
numericVector |
A numeric vector |
min |
Minimum value of the factor variable |
max |
Maximum value of the factor variable |
by |
Difference between the factor variables |
i |
Index of the attribute to be changed. Starts counting from 0, not 1. |
value |
Set attribute to this value |
attributeContainer |
A NetSim attribute container object |
x |
A NetSim attribute container object |
... |
Potential additional arguments |
create_process_state
, create_network
1 2 3 4 5 6 7 8 9 10 11 12 | nActors <- 5
numericVector <- c(rep(0, nActors%/%2), rep(1, nActors - nActors%/%2))
attributeContainer1 <- create_attribute_container(numericVector)
attributeContainer2 <-
create_scale_attribute_container(numericVector, min = 0, max = 2, by = 1)
attributeContainer1 <- set_value(attributeContainer1, i = 0, value = 5)
# does not change anything as 5 is out of range
attributeContainer2 <- set_value(attributeContainer2, i = 0, value = 5)
as.numeric(attributeContainer1)
as.numeric(attributeContainer2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.