Skip to contents

This function is used to calculate the mean, standard deviation and standard error of each day and condition that there is a measurement. This allows us to later plot the summarised data using ggplot2.

Usage

get_stats_from_data(
  df,
  column_days = "days_after_treatment",
  column_conditions = "treatment",
  column_vals = "log10tf"
)

Arguments

df

Dataframe in the long format.

column_days

Name of the column where days are indicated

column_conditions

Name of the column where conditions are indicated

column_vals

Name of the measurement column to be used

Value

A dataframe with statistics from the value specified

Examples

stats_from_data <- get_stats_from_data(t110_ivis_long)
stats_from_data
#> # A tibble: 40 × 5
#>    days_after_treatment treatment    sd  mean    se
#>                   <int> <fct>     <dbl> <dbl> <dbl>
#>  1                    1 ctrl      0.418  7.34 0.158
#>  2                    1 e2        0.517  7.04 0.258
#>  3                    1 p4        0.492  7.44 0.201
#>  4                    1 e2p4      0.672  6.69 0.300
#>  5                    8 ctrl      0.375  7.47 0.142
#>  6                    8 e2        0.529  7.13 0.264
#>  7                    8 p4        0.443  7.56 0.181
#>  8                    8 e2p4      1.09   6.54 0.487
#>  9                   15 ctrl      0.456  7.60 0.172
#> 10                   15 e2        0.520  7.40 0.260
#> # ℹ 30 more rows