0

I wrote a script to show the number of events in a given county. On my local machine, it displays properly and looks great! But when I run the exact same code on the exact same dataset on a secure server (where I have to be able to run the script in order to incorporate data that has higher security requirements) it looks different, and wrong. The legend doesn't show and the color fill in the counties is missing, too.

library(tidyverse)
library(foreign)
library(haven)
library(data.table)
library(devtools)
library(usmap)

joined_v_cross <- read_dta("path/to/my/data/here.dta")

toy_example <- 
  plot_usmap(data = joined_v_cross, values = "toy_values", include = c("AL", "AR", "FL", "GA", "LA", "NC", "SC", "KY", "TN", "MS"), color = "blue") + 
  scale_fill_continuous(low = "white", high = "blue", name = " events count", label = scales::comma) + 
  labs(title = "Example Map", subtitle = "1810 - 1900") +
  theme(legend.position = "right")

toy_example

Map from my local machine:

enter image description here

Map from secure server:

enter image description here

I updated the versions of R, Rstudio, and all of the packages and the maps still look incorrect on the secure server. Any ideas what's going on here? Thank you thank you!

Phil
  • 7,287
  • 3
  • 36
  • 66
  • What are the versions of the packages you are using locally and on the server? Are they all the same? – Phil Jul 06 '23 at 18:18
  • Thanks for your comment. All of the packages are identical -- I just went through and checked them -- and are: tidyverse 2.0.0; usmap 0.6.2; haven 2.5.3; foreign 0.8-84; ggmap 3.0.2; ggplot2 3.4.2; devtools 2.4.5; data.table 1.14.8. The versions of R and Rstudio are different, but that is partly bc my machine is a mac and the server is a PC. Those versions are: my machine: R - 4.2.2 Innocent and Trusting, Rstudio Build 353 Elsbeth Geranium for Mac server: R - 4.3.1 Beagle Scouts, Rstudio 1.4.1103 Wax Begonia for Windows – Elizabeth Breen Jul 07 '23 at 19:20

1 Answers1

0

The answer is, my data wasn't compiling properly on the server and the map output is the result of a column full of NAs. You live, you learn.