diff --git a/R/metar_get.R b/R/metar_get.R index 331eabc..acc3e7c 100644 --- a/R/metar_get.R +++ b/R/metar_get.R @@ -78,10 +78,12 @@ metar_get <- function(airport = "EPWA"){ return(invisible(NULL)) } - metar <- stringr::str_extract(httr::content(myfile, as = "text", encoding = "UTF-8"), pattern = "[:print:]+") - metar <- stringr::str_replace(metar, "", "") - metar <- stringr::str_replace(metar, "", "") + metar <- httr::content(myfile, as = "text", encoding = "UTF-8") + metar <- stringr::str_replace(metar, "\n", "") metar[is.na(metar)] <- "No METAR found!" + if (metar == "") { + metar <- "No METAR found!" + } message("Don't use for flight planning or navigation!") metar }