model_df_to_vector {idmodelr} | R Documentation |
Extracts a Single Column, Summarises if from Simulation
Description
Extracts a Single Column, Summarises if from Simulation
Usage
model_df_to_vector(df, com_var, id_var = NULL, sum_fn = NULL)
Arguments
df |
A data frame of dynamic system output. |
com_var |
The vector to be compared; use unquoted name (NSE). |
id_var |
A character string indicating the id variable to summarise over if required. |
sum_fn |
The summary function to be used, defaults to median. |
Value
Returns a numeric vector, summarised if required.
Examples
library(dplyr)
## Extract a vector with no repeats
model_df_to_vector(iris, Petal.Length)
## Extract a vector and summarise
df <- bind_rows(iris %>% mutate(sim = 1, id = 1:length(sim)),
iris %>% mutate(sim = 2 , id = 1:length(sim)))
model_df_to_vector(df, Petal.Length, "id", sum_fn = mean)
[Package idmodelr version 0.4.0 Index]