I'm using browser to debug and I noticed that one of my data sets has a row that is just NA. The error I'm getting is caused by 'across ()' and spits out 'Problem while computing column 'Property Count'. I'm assuming that's because of an NA row in between the df set, hence why I want to delete the N/A row.
The difficulty is that it is a combined set. I want to include something like na.omit in the code but I'm not sure how to structure it.
Edit: Here is an example of what the combined set looks like:
df = data.frame(
a = c(4,NA,3),
b = c(1,NA,3),
c = c(2,NA,4),
d = c(2,NA,1)
)
This is the actual code
total_stats = stats_combined %>%
rename(`Net Absorption` = `Net Absorption QTD - Total`,
`Net Absorption YTD` = `Net Absorption YTD - Total`,
`Construction Deliveries` = `Construction Deliveries QTD`) %>%
filter(Submarket %in% submarket_order) %>%
mutate(Submarket = factor(Submarket, levels = submarket_order, ordered = T)) %>%
arrange(Submarket) %>%
# glimpse()
mutate(across(c(`Direct Vacancy Rate`, `Overall Vacancy Rate`, `Overall Availability Rate`), scales::percent, accuracy = .1),
across(any_of(sum_vars),
scales::dollar, accuracy = 1, style_negative="parens", prefix=""),
across(any_of(c("Full Service Gross Asking Rate", "Lease Rate")),
scales::dollar)) %>%
select(Submarket, all_of(stat_order))
market_stats_table(total_stats,
cell_width = if_else(property_type == "Office", 1.05, .9),
cell_height = if_else(property_type == "Office", .33, .27),
submarket_order,
totals)
How can I include something like na.omit to avoid getting this error :
Error in $<-.data.frame
(*tmp*
, "call_text", value = c("global key_market_stats(...)", :
replacement has 17 rows, data has 16