Mapping error - need help to debugg


I have tried to plot map for victoria. It is giving me an error in the following statement with this message? any clues to debugg as I am very new to this.

wynPC <- inner_join(vic_PC_shp, wyn, by = c(POA_CODE21 = "Postcode"))
Error in vec_as_location():
! ... must be empty.
x Problematic argument:

  • call = call

The full code is below:

#postcode shape file australia-wide - will have to download file - available online fairly readily - and then change the address to wherever it is in your drive
aus_PC_shp <- read_sf("C:/Users/wsvin/Documents/R/data/POA_2021_AUST_GDA2020.shp")

#LGA shapefile for VIC - same with above - will have to download and change to your own local drive
vic_lga_shp <- read_sf("C:/Users/wsvin/Documents/R/data/vic_lga.shp")

#Filters the australia-wide postcode shapefile to just Victoria
vic_PC_shp <- aus_PC_shp %>% filter(POA_CODE21 %in% (3000:3999))

#This is the excel file that will have the enrolment information in it - in this case it's only for school
wyn <- read_excel("C:/Users/wsvin/Documents/R/data/wyn students gor.xlsx",col_names= TRUE)

#This is the code for the superimposition of the LGA boundary
wynlga <- vic_lga_shp %>% filter(ABB_NAME == "Wyndham")

#this code creates a table of only the top 5 LGAs (had to manually determine)
gortop5 <- vic_lga_shp %>% filter(ABB_NAME %in% c("Melton", "Wyndham", "Moorabool", "Greater Geelong", "Hobsons Bay"))

#combines the above dataframes into the shapefile for mapping
wynPC <- inner_join(vic_PC_shp, wyn, by = c("POA_CODE21" = "Postcode"))

This is not a mapping error (although it kinda looks as a one, given the name location).

The typical root cause for this error is misspelled join column in one of the *_join() family functions.

Are you sure you spelled all variables correctly? Shouldn't the POA_CODE21 be in quotes as a string?

wynPC <- inner_join(vic_PC_shp, wyn, by = c(POA_CODE21 = "Postcode"))

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.