cfreqdist: cfreqdist

View source: R/cumulative_frequency.R

cfreqdistR Documentation

cfreqdist

Description

This function creates a graphic of two plots First plot is the cumulative frequency distribution of two monitoring locations. The second is the cumulative frequency of the difference between the two monitoring locations (station1 - station2). Data input should be a dataframe of data in 'long' format for two locations. Dataframe should have at least 3 columns, station, data, and result.

Usage

cfreqdist(
  df,
  station1 = NULL,
  station2 = NULL,
  station_col = "MLocID",
  date_col = "SampleStartDate",
  result_col = "Result_Numeric",
  p1title = NULL,
  p2title = NULL,
  leg_x_nudge = 0,
  leg_y_nudge = 0,
  x_int_cfd = NULL,
  x_int_cfd_diff = 0
)

Arguments

df

Dataframe of data. Should be in long format

station1

Name of station 1 in the station column (station_col)

station2

Name of station 2 in the station column (station_col)

station_col

Name of the column containing the station names

date_col

Name of the column containing the date information

result_col

Name of the column containing the results to plot

p1title

Title of the cumulative frequency distribution plot

p2title

Title of the difference cumulative frequency distribution plot

leg_x_nudge

Move the legend left or right. (-0.25 to 0.25)

leg_y_nudge

Move the legend up or down. (-0.25 to 0.25)

x_int_cfd

Vertical line on the cfd graph. Used to show water quality standard. If NULL, no line is drawn.

x_int_cfd_diff

Vertical line on the cfd_difference graph. Defaults to 0

Value

plot of all cumulative frequency and cumulative frequency difference Plot

Examples

 ## Not run: 
 library(tidyverse)
 library(AWQMSdata)
 data <- AWQMS_Data(station = c('14046778', '14034470'),
 char = 'Temperature, water',
 stat_base = '7DADM',
 crit_codes = TRUE)


 data <- data %>%
 mutate(stationname = ifelse(MLocID == "14046778", "without dams",
                      ifelse(MLocID == "14034470", "with dams", "ERROR" ) )) %>%
 filter(lubridate::month(SampleStartDate) %in% c(7,8))




 cfreqdist(df = data,
           station1 = "without dams",
           station2 = "with dams",
           station_col = "stationname",
           date_col = "SampleStartDate",
           result_col = "Result_Numeric",
           p1title = "July - August",
           p2title = "Difference")
  
## End(Not run)

TravisPritchardODEQ/TMDLMrkdwn documentation built on Jan. 17, 2024, 5:32 a.m.