You don't need table2 at all, you can calculate all you need directly from table1
library(dplyr)
# Sample data on a copy/paste friendly format, replace this with your own data frame
table1 <- data.frame(
stringsAsFactors = FALSE,
area_id = c("01001","01001","01001",
"01002","01002","01002","01003","01003","01003"),
status = c(1, 2, 3, 1, 2, 3, 1, 2, 3),
count = c(93928,99368,74463,215774,
218672,192941,181151,192095,180232)
)
# Relevant code
table1 %>%
group_by(area_id) %>%
mutate(percentage = count / sum(count))
#> # A tibble: 9 × 4
#> # Groups: area_id [3]
#> area_id status count percentage
#> <chr> <dbl> <dbl> <dbl>
#> 1 01001 1 93928 0.351
#> 2 01001 2 99368 0.371
#> 3 01001 3 74463 0.278
#> 4 01002 1 215774 0.344
#> 5 01002 2 218672 0.349
#> 6 01002 3 192941 0.308
#> 7 01003 1 181151 0.327
#> 8 01003 2 192095 0.347
#> 9 01003 3 180232 0.326
Created on 2022-04-12 by the reprex package (v2.0.1)
Note: Next time please provide a proper REPRoducible EXample (reprex) illustrating your issue.