Skip to contents

Creates a simple time-series plot of melatonin concentration before DLMO segmentation or fitting. This is useful for checking timestamp order, the approximate timing of threshold crossings, and whether a chosen threshold is likely to identify the intended melatonin rise.

Usage

plot_raw_profile(data = NULL, file_path = NULL, threshold = NULL)

Arguments

data

Optional data frame containing datetime and melatonin columns.

file_path

Optional path to a CSV file containing datetime and melatonin columns. Used when data is NULL.

threshold

Optional numeric threshold to draw as a horizontal reference line. If NULL, no threshold line is drawn.

Value

A ggplot2 object showing the raw melatonin time series.

See also

plot_profile() with mode = "raw" for the underlying plotting method.

Examples

filename <- system.file("extdata/sample_melatonin_profile.csv", package = "dlmoR")
plot_raw_profile(file_path = filename, threshold = 5)
#> Loading data from file: /private/var/folders/jc/0t013ckx36db6z5ztm52h3vw0000gn/T/RtmpQ4mYk1/temp_libpath84c12765bdc9/dlmoR/extdata/sample_melatonin_profile.csv
#> Creating 'time' column from 'datetime'.


raw_data <- readr::read_delim(filename, delim = ";")
#> Rows: 19 Columns: 2
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ";"
#> dbl  (1): melatonin
#> dttm (1): datetime
#> 
#>  Use `spec()` to retrieve the full column specification for this data.
#>  Specify the column types or set `show_col_types = FALSE` to quiet this message.
plot_raw_profile(data = raw_data)
#> Creating 'time' column from 'datetime'.