Is there a way I can put in a formula for the loess method such that there is only a little bit of smoothing? The desired smoothed line would be a little less jagged with the beginning and ending more or less flat like the line plot in this case below. What would that formula be? I know the default loess uses formula = 'y ~ x'.
Thanks,
Jeff
library(tidyverse)
library("lubridate")
#> Loading required package: timechange
#>
#> Attaching package: 'lubridate'
#> The following objects are masked from 'package:base':
#>
#> date, intersect, setdiff, union
library("reprex")
turtle_activity_gtm <- read_csv("https://www.dropbox.com/s/unazvh79vcstsuu/mpt_act_rep_fcrawl.csv?dl=1")
#> Rows: 764 Columns: 64
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (22): beach, county, activity, ref_no, activity_comments, encountered?,...
#> dbl (33): uid, activity_no, fcrawl, fcrawl_cum, nest_no, year, month, week,...
#> lgl (6): final_treatment, light_management, relocation_reason, lost_nest, ...
#> date (3): activity_date, emerge_date, inventory_date
#>
#> ℹ 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.
ggplot(data = turtle_activity_gtm) +
geom_line(aes(x=activity_date, y=fcrawl_cum),size=1.5) +
geom_smooth(aes(x=activity_date, y=fcrawl_cum), method = 'loess', se = FALSE, size=0.5)
#> Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
#> ℹ Please use `linewidth` instead.
#> `geom_smooth()` using formula = 'y ~ x'
Created on 2023-01-12 with reprex v2.0.2