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, 2019 in Data Analytics by Sophie may
• 9,900 points
67 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, 2019 by Tyrion anex
• 8,320 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,560 points
4,190 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,560 points
1,639 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
• 50,110 points
2,778 views
0 votes
1 answer

How to create a 2D array of vectors of different lengths in R programming?

You can try making a list of matrices ...READ MORE

answered Feb 1, 2019 in Data Analytics by Sophie may
• 9,900 points
48 views
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,800 points
106 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,800 points
513 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,800 points
544 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 Aug 16, 2019 in Data Analytics by anonymous
• 32,420 points
1,116 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, 2019 in Data Analytics by Tyrion anex
• 8,320 points
75 views