Learn R Programming

ie2misc (version 0.8.6)

expFileOutput: expFileOutput and expFileOutputBATCH

Description

expFileOutput and expFileOutputBATCH process raw .exp files generated by the USGS PeakFQ program (http://water.usgs.gov/software/PeakFQ/). The .exp output file from running PeakFQ is a shortened version of the longer narrative .prt file, more suitable for tabulating the model results than the .prt file; however, the information must be changed to a fixed field format.

Usage

expFileOutput(
  file = tk_choose.files(default = "", caption =
    "Select file(s) to open & hold down Ctrl to choose more than 1 file", multi = TRUE,
    filters = matrix(c("Text file", ".exp", "Text file", ".EXP"), 4, 2, byrow = TRUE)),
  output = c("csv", "xlsx", "both"),
  overwrite = TRUE
)

expFileOutputBATCH( path = tk_choose.dir(caption = "Select the directory with the .exp files"), output = c("csv", "xlsx", "both"), overwrite = TRUE )

Arguments

file

Input .exp file(s), using a file dialog, to obtain 1) the goodness-of-fit and trend results & 2) the exceedance probability values.

output

The exported format for each set of results (options are .csv, .xlsx, and both file types).

overwrite

logical vector that determines whether the existing should be overwritten or not.

path

Directory path of .exp files, to be selected through a directory dialog, to obtain 1) the goodness-of-fit and trend results & 2) the exceedance probability values. The user will be asked where to find the .exp files & then the user will be asked where to save the results files.

Value

.csv, .xlsx, or both file types with 1) the goodness-of-fit and trend results & 2) the exceedance probability values for individual sites in separate files. Currently, in the BATCH mode, all stations in the given directory are combined in a single data.frame with both 1) and 2).

Details

expFileOutput converts the user-selected .exp file to 1) a tab-delimited .csv file for a single station with the goodness-of-fit and trend results (all station information exists in a single row) and 2) a tab-delimited .csv file for a single station with the exceedance probability values on each row. For the .xlsx file, tab 1 contains the goodness-of-fit and trend results and tab 2 contains the exceedance probability values.

expFileOutputBATCH converts the user-selected directory of .exp files into 1) a tab-delimited .csv file as a single table, with one record for each station, with the goodness-of-fit and trend results and 2) a tab-delimited .csv file as a single table, with a set of records for each station, with the exceedance probability values on each row. For the .xlsx file, tab 1 contains the goodness-of-fit and trend results and tab 2 contains the exceedance probability values.

In the Examples section, there is R code for the user to view the example .exp file.

Examples

Run this code
# NOT RUN {
# Example to check the input file format
library("ie2misc")

# Copy and paste the following code into the R console if you
# wish to see the .exp input file format.
# Note the number of lines and the row headings.
file.show(system.file("extdata", "01110000_PEAK_WATSTORE.EXP",
  package = "ie2misc"), title = paste("01110000_PEAK_WATSTORE.EXP"))
# opens the .exp file using the default text editor or within RStudio


# Examples to show you different output cases
expFileOutput(output = "csv") # returns .csv files
# Follow the file dialog instructions

expFileOutput(output = "xlsx") # returns .xlsx files
# Follow the file dialog instructions

expFileOutput(output = "both") # returns .csv and .xlsx files
# Follow the file dialog instructions




# Examples to show you different output cases (BATCH)
expFileOutputBATCH(output = "csv") # returns .csv files
# Follow the file dialog instructions

expFileOutputBATCH(output = "xlsx") # returns .xlsx files
# Follow the file dialog instructions

expFileOutputBATCH(output = "both") # returns .csv and .xlsx files
# Follow the file dialog instructions
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab