
Essentially, what I want to do is utilize my work's sales data to see which of our brands is selling the most in each US state - and have the brand image file in each respective state.
For instance, if the best-selling brand of food we sell in Utah is Nestle - then I want the Nestle logo in that state.
My data set looks like this:
State Brand Sales %TTL
AK Nestle $260 8%
AL Mars $480 10%
AZ Coca Cola $319 12%
...
WY Nestle $200 25%
I have the image files from Google, but I have no idea how to make this work. I know there's the cartography package and I've been following guide - but it isn't really 1:1. I can't even get the sample code to execute because it says it can't find the online address
I don't want this done for me - but how do I start? I essentially want it to look like the map in the first image, but have it correspond with images of the brands we work with.
Tableau didn't really have an optimal solution and this was done in R originally, so I'm trying to replicate it, but it's been proving difficult.
Well, see here an adaptation:
sf(a map ) of the US states. I use hereUSAboundariesbut you can use whaterver you prefer.rowwise()andswitch()to add a column to your data with the url of the pngSee here a reproducible example:
Created on 2022-06-03 by the reprex package (v2.0.1)