Pages

Showing posts with label R. Show all posts
Showing posts with label R. Show all posts

Sunday, March 1, 2015

Book Review: Mastering Scientific Computing with R

PACKT marketing guys again contact me to review their new book Mastering Scientific Computing with R.  The book 432 pages (including covers) is consist of 10 chapters which starts from basic R and ends with advanced data management. However, between the basic R and advanced data management chapters were topics on linear and non linear models, nonparametric techniques, linear and matrix algebra, principal component analysis, and structural equation modeling and confirmatory factor analysis

Aside from code samples (even for R beginners) which include additional comments, there is also an online tutorial on Structural Equation Modeling included in the book webpage which make the book content easier to learn.  In addition, the book also extends discussion beyond the methodological aspect of using R in scientific computing by providing technical and practical approach in some of the methodologies (e.g. "choosing the number of components to retain in Principal Component Analysis", "Rasch analysis using linear algebra and a
paired comparisons matrix", "Exploratory factor analysis and reflective
constructs").

Highly recommended book!




Monday, December 1, 2014

Book Review: R Object-oriented Programming


Recently, Packt Publishing publish the book R Object-oriented Programming. The eleven chapter book covers from basic data types in R to a more advanced method such as simulation and writing functions.  Different data types (i.e. integer, character, factor) are discussed in-depth in the book as well as numeric and string operations. The good thing with it is that it walks the reader from simple to complicated topic making it easier to learn the language. There are two chapters dedicated in discussing about S3 and S4 classes which are not commonly found published books about R. The last two chapters of the book are dedicated case studies wherein the reader can apply all the learnings from previous chapter. A very good book for beginners and basic users who want to advance their skill and explore the full potential of R as a programming language. Good book to have!

Friday, November 14, 2014

Scatter Plot Matrices in R

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



























 

Saturday, August 9, 2014

Book Review: Bioinformatics with R Cookbook



The book BioInformaticswith R Cookbook is a 340 pages book published by PACKT publishing last June. The book is intended for individuals working on the areas of biology and genetics. Most of the techniques and type of analysis (i.e. sequence, protein structure, microarray, etc.) discussed in the book are tailored for practitioners handling genomics data. A typical cookbook style material, the focus of the book is on how to implement the above mentioned techniques using R. The book also tackles procedure on how to connect with genomics databases such as Kyoto Encyclopedia of Genes and Genomes (KEGG) and Gene Ontology as through the Bioconductor platform.  It also tackles access some cloud base implementation of R. The structure of the discussion is very helpful and easy to follow. The How to Do it, How it works, and There’s more.. sequence of discussion provides readers a good guide and grasp on the techniques that are being discussed.
On the other hand, the book is somehow lacking in the discussion of the basics of R software (i.e. intro to the language and data type). The book assumes that the readers have already acquired these basic know how about the language.
Overall, the book is a good reference material especially for individuals dealing with data on biology and genomics.  

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.

Monday, June 2, 2014

Social Media Mining with R (Book Review)

The book Social Media Mining with R is a timely text for researchers and practitioners, specially those in social sciences who want to apply the methods of social media mining and learn basic R. The author provided a good balance of theory and step-by-step approach on how to implement different social media mining techniques (e.g. lexicon-based sentiments). However, the book lacks thorough explanation on how to interpret results from the different social media mining techniques.

The book is useful as complementary material. Major books on social media mining and learning R are still necessary.

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



Sunday, March 2, 2014

Introduction to R for Quantitative Finance Introduction to R for Quantitative Finance (Book Review)

Last November 2013, PACKT Publishing launched the Introduction to R for Quantitative Finance. The book around  which is around 164 pages (including cover page and back pages) discuss the implementation different quantitative methods used in finance using R language . The book consists of nine (9) chapters  cover topics from time series analysis to finance networks.

For individuals with little background in quantitative methods in finance, the theoretical and application discussion in the start of each chapter provided a good overview and basics of the method being discussed. Also, the problem-solution approached used by the authors added practicality on the used of the book for quantitative analysis. However, for individuals (i.e. finance people)  with little R background, the book somehow lacks the basic introduction to the R language and environment commonly found in most R books and tutorials. I think for finance individuals who are R beginners, it will be handy to use this book along with R introductory books/websites (e.g. Instant R, Quick R)

Thursday, October 17, 2013

Mapping Earthquake in Bohol using R

On my previous post a year ago (on mapping earthquake recorded for the Philippines), it can be seen that there were no earthquake (epicenter) recorded for the province of Bohol. But on the 15th of October there were more than 40 quakes recorded that hit the island from early in the morning till late midnight with magnitude ranging from 2.7 to 7.2.

Below is the map, created using R, of earthquakes that hit the province:


Friday, March 1, 2013

Overlapping Histogram in R

While preparing a class exercise involving the use of overlaying of histogram, I searched Google on possible article or discussion on the said topic. Luckily, I found a blog where the author demonstrated an R function to create an overlapping histogram. However, a comment from a guy also showed the same output using transparency. Below were the sample codes that can be used to generate overlapping histogram in R as based on the blog and the viewers comment.

                                                                                                                                     



                                                                                                                        
Here are the codes:

Friday, October 26, 2012

NSCB Sexy Stats Version 2

This was a revised version of my previous post about the NSCB article. With the suggestion from Tal Galili, below were the new pie charts and the R codes to produce these plots by directly scrapping the data from the webpage using XML and RColorBrewer pagkage.

Unemployment by Age Group

Unemployment by Gender

Unemployment by Civil Status

Unemployment by Educational Level

Thursday, October 25, 2012

NSCB Sexy Statistics (Unemployment)


Recently, my friend posted on her Facebook account about the article published by the National Statistical Coordination Board (NSCB) about poverty and unemployment in the country.  Looking at the report I saw a lot of tables, so I thought why not use R to make some graphs out of these tables (with some inspiration from the mazmascience).


Percent Unemployed Per Age Group




Percent Unemployed by Sex Group



 Percent Unemployed by Civil Status





Wednesday, August 8, 2012

Rainfall Amount Flooding Quezon City Philippines

The rainfall received by Quezon City, Philippines was almost double of what the city normally receive for the entire month of August, causing flooding and land slide to various villages in the area.




August 6-7 Rainfall on Metro Manila

Majority of Metro Manila is affected by floods. Looking at the hourly data from PAGASA weather  station located at Bicutan, Taguig, the graph below will gave the viewers of this blog on the rainfall situation in Manila from August 6 (12:00am)-7(11:15 pm), 2012.

Tuesday, August 7, 2012

Provincial Monthly Rainfall of the Philippines from WORLDCLIM

Preparing for a future conference on climate change, I downloaded and extracted average monthly rainfall in the Philippines from worldclim.org. Using maptools, raster, and animation package in R, I produced an animation of average monthly rainfall of the country.


Monday, August 6, 2012

Provincial Map using GADM

This blog demonstrates how to produce political/provincial boundary map (below) using R maptools and raster packages.


 

Monday, July 9, 2012

Trend and Spatial Pattern of Poverty in the Philippines

In a teaching demo that I have conducted, I discussed on how R can be used to analyze trends and spatial pattern of poverty incidence in the Philippines. Playing on the data I got from the National Statistical Coordination Board below is what I got.


 Scatter  Plot Matrix

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Histogram

 


Poverty Incidence Map

 

 

Spatial Pattern