R has several systems for visualizing data, ggplot2 is one of them. ggplot2 is pretty easy to use and offers various options to generate impressive graphs to wow your users. This post is to showcase usage of ggplot and its impressive features.
What you need:
- R System installed on your PC.
- R - Studio Or if you prefer R Console
- tidyverse package
What is tidyverse ? tidyverse is a collection of packages that supports most commonly used packages for data manipulation and visualization. It contains below packages:
- data visualization - ggplot2
- data manipulation - dplyr
- data tidying - tidyr
- data import - readr
- functional programming -purr
Usage - To start using tidyverse, one need to load the package into R first. Loading the package is very easy, just fire up R-Studio and issue below command:
This will load all core tidyverse packages. If the package is not available OR if you see a message "there is no package called 'tidyverse'" - then you need to install the package first and then load the package as below:
The tidyverse package comes with handy sample data sets as well, which is pretty useful to start exploring the graphing capabilities. In order to see all available datasets within a package use the command - data(package = "package name") - see below for usage:
The "ggplot2" package has several data sets which we can use for plotting graphs. To view details about the data sets ( obeservations => rows, variables => columns) , type the data set name at command prompt , as below. This will lists a sample data and the variable names.
To know what each of these variables (columns) in the data set means just use the help function :
?datasetname
The help function can be used with any of the R commands / packages to know more details about them.
How to use "ggplot2" in next part... soon.
Really Good blog post.provided a helpful information.I hope that you will post more updates like this Data Science online Course Bangalore
ReplyDeleteI loved your post.Much thanks again. Fantastic.
ReplyDeleteP0wer bi onlinetraining
P0wer bi training