qc_as_timestamp: Convert known bad formats to correct timestamp format and set...

View source: R/qc_data_general_checks.R

qc_as_timestampR Documentation

Convert known bad formats to correct timestamp format and set timezone

Description

Converting known bad timestamp formats to POSIXt and setting the correct timezone

Usage

qc_as_timestamp(data, site_data, parent_logger = "test")

Arguments

data

Data frame containing timestamp variable. Also it can be a vector with timestamp values

Details

When loading data from csv files, depending on the office version and workflow to introduce timestamp and data, timestamp can result in the wrong format (lost of seconds, for example). This function checks for known formatting errors and try to fix them.

Value

An object of the same type of input (data frame or vector) with the fixed values of timestamp. If timestamp is already in format, a message appears and none fix is made, returning data as entered. If timestamp can not be fixed, an error is raised.

Timezone

This function also set the timezone attribute to the POSIXt timestamp. It uses qc_get_timezone and qc_set_timezone functions internally to get the timezone from the env_time_zone variable, transforming it to a compatible timezone name and set it as a POSIXt attribute.

See Also

Other Data Loading Functions: dl_data_col_classes(), dl_get_si_code_psi(), dl_metadata(), remove_dupcols()


vflo/PSIsapfluxnetQC1 documentation built on Feb. 15, 2024, 3:19 a.m.