Clean mailing label CSV: blank owner_2, trim label, add city/state/zip
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(
|
output$download_filtered <- downloadHandler(
|
||||||
filename = "st_andrews_owners_filtered.csv",
|
filename = "st_andrews_owners_filtered.csv",
|
||||||
content = function(file) {
|
content = function(file) {
|
||||||
filteredOwners() |>
|
write.csv(prep_mailing(filteredOwners()), file, row.names = FALSE)
|
||||||
sf::st_drop_geometry() |>
|
|
||||||
dplyr::select(owner_1, owner_2, label) |>
|
|
||||||
write.csv(file, row.names = FALSE)
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
output$download_all <- downloadHandler(
|
output$download_all <- downloadHandler(
|
||||||
filename = "st_andrews_owners_all.csv",
|
filename = "st_andrews_owners_all.csv",
|
||||||
content = function(file) {
|
content = function(file) {
|
||||||
owners |>
|
write.csv(prep_mailing(owners), file, row.names = FALSE)
|
||||||
sf::st_drop_geometry() |>
|
|
||||||
dplyr::select(owner_1, owner_2, label) |>
|
|
||||||
write.csv(file, row.names = FALSE)
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user