R programming: Plot color-coded map of world leader's age

0 votes

I am currently working on R programming. I'm new to this field, I want to plot color-coded map of world leader's age.

I want to know how many countries are included in R program? I've looked into the documentation of rworldmap but unfortunately I cant get any list of countries. How can I find this out?

Jan 7 in Data Analytics by Sophie may
• 9,530 points
46 views

1 answer to this question.

0 votes

In the structure of the value returned by the getMap function, it appears that column "NAME" stores the name of an area in the map while "SOVEREIGNT" is the name of the corresponding sovereign state.

Follow this code to extract the unique values in both columns:

library(rworldmap)
world_map <- getMap()
areas <- levels(world_map[["NAME"]])
sovereign_states <- levels(world_map[["SOVEREIGNT"]])
answered Jan 7 by Tyrion anex
• 8,280 points

Related Questions In Data Analytics

0 votes
1 answer

Changing the order of bars in a bar-plot - ggplot2 - R

You can use the scale_x_discrete() function with ...READ MORE

answered May 28, 2018 in Data Analytics by Bharani
• 4,550 points
2,300 views
0 votes
1 answer

Showing percentage instead of counts in a bar plot - ggplot2 - R

Load the 'scales' package first, which gives ...READ MORE

answered May 28, 2018 in Data Analytics by Bharani
• 4,550 points
1,150 views
0 votes
1 answer

“subscript out of bounds” Error in r programming

This error is likely to occur when ...READ MORE

answered Oct 31, 2018 in Data Analytics by Kalgi
• 39,310 points
1,157 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How do I modify the background grid in ggplot?

You can use the function called background_grid().  This ...READ MORE

answered Dec 6, 2018 in Data Analytics by Maverick
• 10,040 points
52 views
0 votes
1 answer

I'm trying to start rattle on R Studio and end up with an error

You need the package RGtk2 for rattle to ...READ MORE

answered Nov 26, 2018 in Data Analytics by Maverick
• 10,040 points
247 views
0 votes
1 answer

Error saying "could not find function "shinyUI"" in shiny R

Its a small spelling mistake that you've ...READ MORE

answered Nov 28, 2018 in Data Analytics by Maverick
• 10,040 points
350 views
0 votes
2 answers

How to change the value of a variable using R programming in a data frame?

You are getting this error since the ...READ MORE

answered 6 days ago in Data Analytics by anonymous
• 21,110 points
119 views
0 votes
1 answer

R programming: How to subset data and plot graphs in R?

You can create a grouping variable depending ...READ MORE

answered Feb 18 in Data Analytics by Tyrion anex
• 8,280 points
49 views