You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#' Aligns Date and Time Data Based on Official Station Records
2
-
#'
3
-
#' This function compares date and time data from a user-provided dataframe (`df`) against an official record stored in a CSV file. It checks if the date-time for each station in the input dataframe matches the expected values from the official record, based on station, year, and season. The function attempts to correct mismatches where possible and reports any discrepancies. It updates the `date_time` column in the input dataframe where necessary and provides messages about the status of each match.
4
-
#'
5
-
#' @param df A dataframe containing station data with a `date_time` column. The dataframe must include a `station` column to match against the official record.
6
-
#'
7
-
#' @return A dataframe with the same structure as the input dataframe (`df`), but with updated `date_time` values where mismatches are corrected. The columns `year_date_time` and `season_date_time` are removed from the output.
8
-
#'
9
-
#' @details
10
-
#' The function performs the following steps:
11
-
#' 1. Loads an official record CSV containing expected station data.
12
-
#' 2. Adds `year_date_time` and `season_date_time` columns to the input dataframe (`df`) and the official record using the `lubridate` package and the `infer_season` function.
13
-
#' 3. Compares the `date_time` column from `df` to the official record, checking for matches by station, year, and season.
14
-
#' 4. For each row, it outputs a message describing the match status (e.g., no match, partial match, or full match).
15
-
#' 5. Updates the `date_time` column in the input dataframe if a mismatch is found and a valid correction is possible.
16
-
#' 6. Returns the updated dataframe with corrected date-time values.
17
-
#'
18
-
#' @import httr
19
-
#' @import lubridate
20
-
#' @import dplyr
21
-
#'
22
-
#' @examples
23
-
#' # Assuming 'df' is a dataframe with a 'station' and 'date_time' column
#' Aligns Date and Time Data Based on Official Station Records
2
+
#'
3
+
#' This function compares date and time data from a user-provided dataframe (`df`) against an official record stored in a CSV file. It checks if the date-time for each station in the input dataframe matches the expected values from the official record, based on station, year, and season. The function attempts to correct mismatches where possible and reports any discrepancies. It updates the `date_time` column in the input dataframe where necessary and provides messages about the status of each match.
4
+
#'
5
+
#' @param df A dataframe containing station data with a `date_time` column. The dataframe must include a `station` column to match against the official record.
6
+
#'
7
+
#' @return A dataframe with the same structure as the input dataframe (`df`), but with updated `date_time` values where mismatches are corrected. The columns `year_date_time` and `season_date_time` are removed from the output.
8
+
#'
9
+
#' @details
10
+
#' The function performs the following steps:
11
+
#' 1. Loads an official record CSV containing expected station data.
12
+
#' 2. Adds `year_date_time` and `season_date_time` columns to the input dataframe (`df`) and the official record using the `lubridate` package and the `infer_season` function.
13
+
#' 3. Compares the `date_time` column from `df` to the official record, checking for matches by station, year, and season.
14
+
#' 4. For each row, it outputs a message describing the match status (e.g., no match, partial match, or full match).
15
+
#' 5. Updates the `date_time` column in the input dataframe if a mismatch is found and a valid correction is possible.
16
+
#' 6. Returns the updated dataframe with corrected date-time values.
17
+
#'
18
+
#' @import httr
19
+
#' @import lubridate
20
+
#' @import dplyr
21
+
#'
22
+
#' @examples
23
+
#' # Assuming 'df' is a dataframe with a 'station' and 'date_time' column
0 commit comments