From 2125b25e9436c88ebb0a1bea28f8f373b0722177 Mon Sep 17 00:00:00 2001 From: jsta Date: Mon, 5 Sep 2016 09:30:36 -0400 Subject: [PATCH] specify encoding for readHTMLTable --- R/dbhydro_get.R | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/R/dbhydro_get.R b/R/dbhydro_get.R index c34953d..7c4cc4b 100644 --- a/R/dbhydro_get.R +++ b/R/dbhydro_get.R @@ -380,7 +380,8 @@ get_dbkey <- function(category, stationid = NA, param = NA, freq = NA, } if(detail.level == "full"){ - res <- XML::readHTMLTable(res, stringsAsFactors = FALSE)[[3]] + res <- XML::readHTMLTable(res, stringsAsFactors = FALSE, + encoding = "UTF-8")[[3]] names(res) <- gsub("\\n", "", names(res)) format_coords <- function(dt){ @@ -405,7 +406,8 @@ get_dbkey <- function(category, stationid = NA, param = NA, freq = NA, res[,c("Latitude", "Longitude")] <- format_coords(res) }else{ - res <- XML::readHTMLTable(res)[[3]][,c("Dbkey", "Group", "Data Type", + res <- XML::readHTMLTable(res, stringsAsFactors = FALSE, + encoding = "UTF-8")[[3]][,c("Dbkey", "Group", "Data Type", "Freq", "Recorder", "Start Date", "End Date")] }