Write a data frame to a directory with all numbers rounded to specified digits. Can write as .xls, .xlsx, or .csv file types. Writing as .xlsx or .xls uses the writexl package.

write_results(data, file_name, digits)

Arguments

data

Data frame to be written to a directory.

file_name

Character string naming the output file. Required.

digits

Integer indicating the number of decimal places or significant digits used to round flow values. Use follows that of base::round() digits argument.

Examples

if (FALSE) {

# Working examples:

# Example data to write
data_results <- calc_longterm_daily_stats(station_number = c("08HA002", "08HA011"),
                                          start_year = 1971, end_year = 2000)

# Write the data and round numbers to 1 decimal place
write_results(data = data_results, 
              file_name = "Cowichan River Long-term Flows (1971-2000).xlsx", 
              digits = 1)
              
}