One of our graduate student ask me on how he can check for correlated variables on his dataset. Using R, his problem can be done is three (3) ways. First, he can use the cor function of the stat package to calculate correlation coefficient between variables. Second, he can use functions such as pairs (graphics) to visually check possible correlated variables. Third, he can combine the first two approach following the example of vinux in stackoverflow or using ggpairs function of GGally package.
First Approach
Sepal.Length Sepal.Width Petal.Length Petal.Width
Sepal.Length 1.0000000 -0.1175698 0.8717538 0.8179411
Sepal.Width -0.1175698 1.0000000 -0.4284401 -0.3661259
Petal.Length 0.8717538 -0.4284401 1.0000000 0.9628654
Petal.Width 0.8179411 -0.3661259 0.9628654 1.0000000
Second Approach
Third Approach
Showing posts with label ggplot2. Show all posts
Showing posts with label ggplot2. Show all posts
Friday, November 14, 2014
Sunday, June 15, 2014
Creating Inset Map with ggplot2
According to wiki.GIS.com one of the reason for using inset map is to provide a reference for an area for unfamiliar readers. Inset map is also considered a great asset for cartographers. Most of the GIS software available in the market have a provision for non-cartographer and beginners to create inset map. However, for R users who are into making maps, creating inset map is a bit challenging. Thanks to the post of Pascal Mickelson and Scott Chamberlain which gave users like me a guide on how to create inset map in R using ggplot2. Below is an example of map with inset created using R.
Sunday, June 1, 2014
Malawi Animated Rainfall Map
Couple of months ago, Charles Langton Vanya of Malawi contacted me on how to make animated rainfall map in R. I was very busy that I was not able to respond. Anyway, to Mr. Vanya, here is the code you can play on to produce a similar map as below.
Saturday, May 31, 2014
Mindoro Digital Elevation Map Updated
Almost 2 years ago, I made a post on creating digital elevation map using R. For that post, I used the basic R plotting function to create the map. Recently, I started learning to use ggplot2 package for visualizing data. Today, I created the same map that I did two years ago, using raster and gpplot2, its for you guys to tell the difference.
Happy Coding! Use R!
Before
After
Happy Coding! Use R!
Before
After
Labels:
DEM,
ggplot2,
Mapping with R,
Mindoro,
Philippines,
R,
raster
Monday, May 21, 2012
Mapping Philippines earthquake data from January 2011 to January 2012
Mapping Philippines earthquake data from January 2011 to January 2012 collected by PHIVOLCS using R ggplot package.
I tried to recreate the earthquake map of the Philippines created using maptool and R plot function using ggplot2.
![]() |
Earthquake map using plot function |
![]() |
Earthquake map using ggplot function |
Subscribe to:
Posts (Atom)