sebastianbarfort / mapDK

R package for making maps of Denmark
49 stars 5 forks source link

`tbl_df` error #12

Closed sebastianbarfort closed 8 years ago

sebastianbarfort commented 8 years ago

This causes an error. Comes from dplyr's tbl_df conversion.

df_DK_votes = mapDK::votes

df_polling = mapDK::polling
df_municipality = mapDK::municipality

Unik_muni = distinct(select(df_polling, KommuneNav, KommuneNum))
Unik_muni_id= distinct(select(df_polling, KommuneNav, KommuneNum,id))

df_DK_Muni_Merge = left_join(df_DK_votes, Unik_muni_id)

by_KomNav = df_DK_Muni_Merge %>%
group_by(KommuneNav, KommuneNum, navn) %>%
summarise(stemmer = sum(stemmer), n = n(), gnsn_pct_point=stemmer/n)
by_KomNav=ungroup(by_KomNav)
Fejl = filter(by_KomNav, navn == "detkonservativefolkeparti")

mapDK(values = "stemmer", id = "KommuneNav",
data = Fejl,
detail = "municipal", show_missing = TRUE)