We use cookies, including third-party cookies from Google to serve personalized ads through AdSense, to operate this site and understand how it is used. By continuing to browse, you accept this use. See our Privacy Policy and Terms of Use for details, including how to opt out of personalized advertising.
Accept
SmartData CollectiveSmartData Collective
  • Analytics
    AnalyticsShow More
    What Kind of Problem-Solving Distinguishes Data Analysts From Software Engineers -- AI-generated illustration
    What Kind of Problem-Solving Distinguishes Data Analysts From Software Engineers
    7 Min Read
    chatgpt image jul 21, 2026, 04 34 30 pm
    4 Core Benefits of Predictive Maintenance after Vibration Analysis
    10 Min Read
    How Does Data Mining Boost Customer Satisfaction in Logistics? Harnessing Analytics for Results -- AI-generated illustration
    How Does Data Mining Boost Customer Satisfaction in Logistics? Harnessing Analytics for Results
    11 Min Read
    chatgpt image jul 13, 2026, 04 23 45 pm
    How Data Analytics Helps Companies Improve User Engagement
    19 Min Read
    chatgpt image jul 13, 2026, 03 59 46 pm
    How Data Analytics Improves Multi-Location Search Strategies
    10 Min Read
  • Big Data
  • BI
  • Exclusive
  • IT
  • Marketing
  • Software
Search
© 2008-25 SmartData Collective. All Rights Reserved.
Reading: Geographic maps in R
Share
Notification
Font ResizerAa
SmartData CollectiveSmartData Collective
Font ResizerAa
Search
  • About
  • Help
  • Privacy
Follow US
© 2008-23 SmartData Collective. All Rights Reserved.
SmartData Collective > Big Data > Data Visualization > Geographic maps in R
Data Visualization

Geographic maps in R

DavidMSmith
DavidMSmith
3 Min Read
Geographic maps in R
Illustration generated with FLUX.2 [klein 4B] via Cloudflare Workers AI.
SHARE

The maps library for R is a powerful tool for creating maps of countries and regions of the world. For example, you can create a map of the USA and its states in just three lines of code:

library(maps)

map(“state”, interior = FALSE)

More Read

10 Don’ts for Delivering Mobile Business Intelligence
10 Don’ts for Delivering Mobile Business Intelligence
How to Speak Like a Data Scientist
Socializing
The Information Supply Chain and the Growth of Enterprise App Stores
Want More Actionable Information from Your BI? Support Your IT Team’s Need for Data Warehouse Automation

map(“state”, boundary = FALSE, col=“gray”, add = TRUE)

USA map

The coordinate system of the graph is latitude and longitude, so it’s easy to overlay other spatial data on this map.

Unfortunately, the data for the maps library isn’t sufficient for some applications. The maps themselves are fairly low-resolution (although higher-resolution data is available in the mapdata package), and political boundaries can be incomplete or out-of-date. Luckily, there are now free online resources where you can find updated map data for use with R. 

GADM is a spatial database of the location of the world’s administrative boundaries, and as Claudia Engel discovered the map information is available as native R objects that can be plotted directly with the spplot function (from the sp package). For example, here’s how to load the data for Switzerland, and then plot each canton with a color denoting its primary language:

library(sp)
con <- url(“http://gadm.org/data/rda/CHE_adm1.RData”)
print(load(con))
close(con)

language <- c(“german”, “german”, “german”,“german”,
 “german”,“german”,“french”, “french”,
 “german”,“german”,“french”, “french”, 
 “german”, “french”,“german”,“german”,
 “german”,“german”,“german”, “german”,
 “german”,“italian”,“german”,“french”,
 “french”,“german”,“german”)
gadm$language <- as.factor(language)
col = rainbow(length(levels(gadm$language)))
spplot(gadm, “language”, col.regions=col, main=“Swiss Language Regions”)

    Swiss_lang
    Sweet!

    AnthroSpace: Download Global Administrative Areas as RData files


    TAGGED:r language
    Share This Article
    Facebook Pinterest LinkedIn
    Share

    Follow us on Facebook

    Latest News

    Flat editorial illustration: The article connects commercial drone capture with integrated software workflows that organize and r
    Drone Technology as a Business Investment: Calculating ROI, Costs, and Long-Term Value
    Business Intelligence Marketing Software
    Flat editorial illustration: The article connects weekly technician productivity and related shop metrics to timely scheduling an
    Workforce Analytics for Auto Repair Shops: Reading Technician Productivity Weekly
    Business Intelligence Exclusive
    Flat editorial illustration: A business-editorial depiction of two account-growth routes: data-guided targeted advertising and cr
    Targeted Ads and Cross-Promotion: Using Audience Segments and Platform Statistics to Grow
    Exclusive Social Data
    Flat editorial illustration: Business and SaaS-editorial concept: a prospective development team proves its fit by testing a boun
    Hiring a Dedicated Development Team for Your Existing Stack and Delivery Process
    Development Exclusive

    Stay Connected

    1.2KFollowersLike
    33.7KFollowersFollow
    222FollowersPin

    You Might also Like

    Resampling Data in Hadoop with RHadoop
    Big DataHadoopR Programming Language

    Resampling Data in Hadoop with RHadoop

    1 Min Read
    SnapLogic: Making Big Data Integration as a Service a Hadoop Reality
    Uncategorized

    SnapLogic: Making Big Data Integration as a Service a Hadoop Reality

    4 Min Read
    Votamatic Predicted the Presidential Election Results with R
    AnalyticsNews

    Votamatic Predicted the Presidential Election Results with R

    4 Min Read
    R Script Creates a Map of Worldwide Email Traffic
    AnalyticsBig DataData VisualizationModelingR Programming LanguageSocial DataSocial Media Analytics

    R Script Creates a Map of Worldwide Email Traffic

    3 Min Read

    SmartData Collective is one of the largest & trusted community covering technical content about Big Data, BI, Cloud, Analytics, Artificial Intelligence, IoT & more.

    ai chatbot
    How AI Website Chatbots Improve Customer Support and Lead Generation
    Chatbots Exclusive
    Chatbots and SEO: How Can Chatbots Improve Your SEO Ranking?
    Chatbots and SEO: How Can Chatbots Improve Your SEO Ranking?
    Artificial Intelligence Chatbots Exclusive

    Quick Link

    • About
    • Contact
    • Privacy
    Follow US
    © 2008-26 SmartData Collective. All Rights Reserved.
    Welcome Back!

    Sign in to your account

    Username or Email Address
    Password

    Lost your password?