Clean mailing label CSV: blank owner_2, trim label, add city/state/zip
All checks were successful
Deploy stAndrews / deploy (push) Successful in 6s
All checks were successful
Deploy stAndrews / deploy (push) Successful in 6s
This commit is contained in:
24
app.R
24
app.R
@@ -424,23 +424,31 @@ server <- function(input, output) {
|
||||
)
|
||||
)
|
||||
})
|
||||
prep_mailing <- function(data) {
|
||||
data |>
|
||||
sf::st_drop_geometry() |>
|
||||
dplyr::select(owner_1, owner_2, label) |>
|
||||
dplyr::mutate(
|
||||
owner_2 = dplyr::na_if(owner_2, "NA"),
|
||||
owner_2 = ifelse(is.na(owner_2), "", owner_2),
|
||||
label = stringr::str_squish(label),
|
||||
city = "Venice",
|
||||
state = "FL",
|
||||
zip = "34285"
|
||||
)
|
||||
}
|
||||
|
||||
output$download_filtered <- downloadHandler(
|
||||
filename = "st_andrews_owners_filtered.csv",
|
||||
content = function(file) {
|
||||
filteredOwners() |>
|
||||
sf::st_drop_geometry() |>
|
||||
dplyr::select(owner_1, owner_2, label) |>
|
||||
write.csv(file, row.names = FALSE)
|
||||
write.csv(prep_mailing(filteredOwners()), file, row.names = FALSE)
|
||||
}
|
||||
)
|
||||
|
||||
output$download_all <- downloadHandler(
|
||||
filename = "st_andrews_owners_all.csv",
|
||||
content = function(file) {
|
||||
owners |>
|
||||
sf::st_drop_geometry() |>
|
||||
dplyr::select(owner_1, owner_2, label) |>
|
||||
write.csv(file, row.names = FALSE)
|
||||
write.csv(prep_mailing(owners), file, row.names = FALSE)
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user