Commit 2880bd9f authored by David Watkins's avatar David Watkins
Browse files

columns in empty data frame

parent 02b0d456
...@@ -93,7 +93,6 @@ importNGWMN <- function(input, asDateTime=FALSE, tz="UTC"){ ...@@ -93,7 +93,6 @@ importNGWMN <- function(input, asDateTime=FALSE, tz="UTC"){
attr(mergedDF, "contact") <- xml_attr(meta, "href") attr(mergedDF, "contact") <- xml_attr(meta, "href")
attr(mergedDF, "responsibleParty") <- xml_text(xml_find_all(meta, ".//gco:CharacterString")) attr(mergedDF, "responsibleParty") <- xml_text(xml_find_all(meta, ".//gco:CharacterString"))
}else if(response == "GetFeatureOfInterestResponse"){ }else if(response == "GetFeatureOfInterestResponse"){
featureMembers <- xml_find_all(returnedDoc, ".//sos:featureMember") featureMembers <- xml_find_all(returnedDoc, ".//sos:featureMember")
site <- xml_text(xml_find_all(featureMembers,".//gml:identifier")) site <- xml_text(xml_find_all(featureMembers,".//gml:identifier"))
...@@ -149,7 +148,9 @@ importWaterML2 <- function(input, asDateTime=FALSE, tz="UTC") { ...@@ -149,7 +148,9 @@ importWaterML2 <- function(input, asDateTime=FALSE, tz="UTC") {
gmlID <- xml_attr(returnedDoc,"id") #TODO: make this an attribute gmlID <- xml_attr(returnedDoc,"id") #TODO: make this an attribute
TVP <- xml_find_all(returnedDoc, ".//wml2:MeasurementTVP")#time-value pairs TVP <- xml_find_all(returnedDoc, ".//wml2:MeasurementTVP")#time-value pairs
if(length(TVP) == 0) { #empty nodes on some sites if(length(TVP) == 0) { #empty nodes on some sites
return(data.frame()) return(data.frame(site = character(0), source = character(0), date = character(0),
time = character(0), dateTime = character(0), value = numeric(0),
uom = character(0), comment = charater(0), stringsAsFactors = FALSE))
} }
rawTime <- xml_text(xml_find_all(TVP,".//wml2:time")) rawTime <- xml_text(xml_find_all(TVP,".//wml2:time"))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment