title: Error with Plotting Cartogram - 'This function does not give correct centroids and distances for longitude/latitude data.'
body: <p>I'm trying to use the wrld_simple data from the maptools package to plot a Cartogram that involves some European countries based on their Population in 2005: </p>
  
  <pre><code>countries = c('Austria', 'Belgium', 'Bulgaria', 'Cyprus', 'Czech Republic', 'Denmark', 'Estonia', 'Finland', 'France', 'Germany', 'Greece', 'Hungary', 'Iceland', 'Ireland', 'Italy', 'Latvia', 'Lithuania', 'Luxembourg', 'Malta', 'Netherlands', 'Norway', 'Poland', 'Portugal', 'Slovenia', 'Spain', 'Sweden', 'United Kingdom')
  
  </code></pre>
  
  <p>Using the maptools package, I got the wrld_simpl data, and retrieved the data for those particular countries:</p>
  
  <pre><code>data(wrld_simpl)
  
  mapsimple = wrld_simpl[wrld_simpl$NAME %in% countries]
  
  plot(mapsimple)
  </code></pre>
  
  <p>So far so good, but when I plot it out: </p>
  
  <pre><code>cartogram= cartogram(mapping1, "POP2005", itermax = 7)
  
  Please use cartogram_cont() instead of cartogram().
  
  Error: Using an unprojected map. This function does not give correct centroids and distances for longitude/latitude data:
  Use "st_transform()" to transform coordinates to another projection.
  
  </code></pre>
  
  <p>I try using cartogram_cont:</p>
  
  <pre><code>&gt; cartogram= cartogram_cont(mapping1, "POP2005", itermax = 7)
  
  Error: Using an unprojected map. This function does not give correct centroids and distances for longitude/latitude data:
  Use "st_transform()" to transform coordinates to another projection.
  
  </code></pre>
  
  <p>I tried transforming it to sf and then doing the st_transform(), but to no avail:</p>
  
  <pre><code>sfno = st_as_sf(mapping1)
  
  sfnoproj = st_transform(sfno, coords = c("lon", "lat"), crs = "+proj=longlat +datum=WGS84", agr = "constant")
  
  cartogram= cartogram_cont(sfnoproj, "POP2005", itermax = 7)
  
  Error: Using an unprojected map. This function does not give correct centroids and distances for longitude/latitude data:
  
  Use "st_transform()" to transform coordinates to another projection.
  </code></pre>
  
  <p>I'm assuming I don't have the correct values for the projection right. How would I know to set it better? If I were to use other values besides 'POP2005', how do I go about it? What does the 'itermax' in cartogram mean (I don't quite understand the given definition)</p>
  
  <p>Any help would be greatly appreciated as I'm quite new to this. Thank you!!!!</p>