collapse_data | R Documentation |
Take a 'data.frame' and return compact 'data.frame' of event types and strategies.
collapse_data(
data,
model,
drop_NA = TRUE,
drop_family = FALSE,
summary = FALSE
)
data |
A |
model |
A |
drop_NA |
Logical. Whether to exclude strategy families that contain no observed data. Exceptionally if no data is provided, minimal data on data on first node is returned. Defaults to 'TRUE' |
drop_family |
Logical. Whether to remove column |
summary |
Logical. Whether to return summary of the data. See details. Defaults to 'FALSE'. |
A vector of data events
If summary = TRUE
'collapse_data' returns a list containing the
following components:
data_events |
A compact data.frame of event types and strategies. |
observed_events |
A vector of character strings specifying the events observed in the data |
unobserved_events |
A vector of character strings specifying the events not observed in the data |
model <- make_model('X -> Y')
df <- data.frame(X = c(0,1,NA), Y = c(0,0,1))
df %>% collapse_data(model)
collapse_data(df, model, drop_NA = FALSE)
collapse_data(df, model, drop_family = TRUE)
collapse_data(df, model, summary = TRUE)
data <- make_data(model, n = 0)
collapse_data(data, model)
model <- make_model('X -> Y') %>% set_restrictions('X[]==1')
df <- make_data(model, n = 10)
df[1,1] <- ''
collapse_data(df, model)
data <- data.frame(X= 0:1)
collapse_data(data, model)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.