#' Generates individual building statistic
#'
#' Pulls the data on a single house
#' @param hrrp_wcode input string of ward code
#' @param howner_sn homeowner serial number
#' @param house_sn house serial number
#' @return dataframes with data
#' @export
#' @examples
#' generateBuildingReport("524 1 02 07 3 015 1")
#'
generateBuildingReport <- function(hrrp_wcode, howner_sn, house_sn) {
pg <- dbDriver("PostgreSQL")
con <- dbConnect(pg, user="bradleywilson", password="",
host="localhost", port=5432, dbname="Nepal")
building <- dbReadTable(con, building)
ward.code <- paste("hrrp_wcode='",hrrp_wcode,"'", sep = "")
howner <- paste("howner_sn='",howner_sn,"'", sep = "")
house <- paste("house_sn='",house_sn,"'", sep = "")
query <- paste("select * from building where", ward.code,
"and", howner, "and", house, sep = " ")
structure <- dbGetQuery(con, query)
ovals <- lapply(c(1:107), function(x) structure[[x]])
bldg_info <- mapply(labelValue, colnames(structure), ovals)
bldg_info[5:15] <- structure[5:15]
bldg_info[105:107] <- structure[105:107]
bldg_info$dm_grade <- structure$dm_grade
bldg_info$collapse <- structure$collapse
bldg_info <- Filter(function(x) !identical(character(0),x), bldg_info)
dbDisconnect(con)
return(bldg_info)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.