expanded=TRUE not working correctly for QW data
Created by: jlthomps
Using readNWISqw, constructNWISURL, importRDB1 and readNWISdata, the argument for 'expanded' data attributes does not translate correctly to the URL (as, eg, &rdb_qw_attributes=expanded). It looks like the function(s) are using 'expanded=TRUE' to set 'qw_sample_wide=wide', which is not the same thing. In the REST URL, qw_sample_wide=wide results in a wide (rather than long) dataset, where each sample is one row of data, with multiple columns for different parameters. This format does not include the other columns included in the rdb_qw_attributes=expanded, such as anl_dt and result_lab_cm_tx.
To illustrate, running: urlQW <- constructNWISURL("450456092225801","70300",startDate="",endDate="","qw",expanded=TRUE) results in the URL
As you can see, this URL specifies rdb_qw_attributes=0 rather than rdb_qw_attributes=expanded. For the moment, in order to pull these extra result columns, I am modifying the url created by 'constructNWISURL'. So,
urlQW <- constructNWISURL("450456092225801","70300",startDate="",endDate="","qw",expanded=TRUE) qwData2 <- importRDB1(urlQW,asDateTime=TRUE,qw=TRUE,tz="") urlQW2 <- gsub("rdb_qw_attributes=0","rdb_qw_attributes=expanded",urlQW) qwData4 <- importRDB1(urlQW2,asDateTime=TRUE,qw=TRUE,tz="")