Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Commit

Permalink
specify encoding for readHTMLTable
Browse files Browse the repository at this point in the history
  • Loading branch information
jsta committed Sep 5, 2016
1 parent 572d6cd commit 2125b25
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions R/dbhydro_get.R
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand All @@ -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")]
}

Expand Down

0 comments on commit 2125b25

Please sign in to comment.