Skip to contents

Plot the Pipe Conditions over Time

Usage

plot_pipe_conditions(
  x,
  column_instyear = "instyear",
  column_ident = "ident",
  column_inspyear = "inspyear",
  column_condition = "condition",
  colour_values = c(C4 = "green", C3 = "yellow", C2 = "orange", C1 = "red", "grey"),
  y_labels = FALSE,
  facet_by = sprintf(kwb.utils::underscoreToPercent("~(10*as.integer(_s/10))"),
    column_instyear),
  by_pipe = FALSE
)

Arguments

x

data frame

column_instyear

name of column containing the installation year

column_ident

name of column containing the pipe identifier

column_inspyear

name of column containing the inspection year

column_condition

name of column containing the pipe condition

colour_values

named vector of colour names. The names must refer to the values in column_condition.

y_labels

logical. If TRUE tick marks and labels are plotted on the y axis, else not.

facet_by

character string representing a formula to be used to create facets with facet_wrap. Set to NULL if no facets are desired.

by_pipe

if TRUE one plot is created for each pipe and a list of these plots is returned

Examples

if (FALSE) {
x <- kwbGompitz:::readObservations(kwbGompitz::exampleFile("obs.txt"))
plot_pipe_conditions(x[1:100, ])
}