Tuesday 30 April 2019

Learn RStudio IDE

Discover how to use the popular RStudio IDE as a professional tool that includes code refactoring support, debugging, and Git version control integration. This book gives you a tour of RStudio and shows you how it helps you do exploratory data analysis; build data visualizations with ggplot; and create custom R packages and web-based interactive visualizations with Shiny. 
In addition, you will cover common data analysis tasks including importing data from diverse sources such as SAS files, CSV files, and JSON. You will map out the features in RStudio so that you will be able to customize RStudio to fit your own style of coding.

Finally, you will see how to save a ton of time by adopting best practices and using packages to extend RStudio. Learn RStudio IDE is a quick, no-nonsense tutorial of RStudio that will give you a head start to develop the insights you need in your data science projects.

What You Will Learn
  • Quickly, effectively, and productively use RStudio IDE for building data science applications
  • Install RStudio and program your first Hello World application
  • Adopt the RStudio workflow 
  • Make your code reusable using RStudio
  • Use RStudio and Shiny for data visualization projects
  • Debug your code with RStudio 
  • Import CSV, SPSS, SAS, JSON, and other data

Who This Book Is For

Programmers who want to start doing data science, but don’t know what tools to focus on to get up to speed quickly. 

Buy :

PDF Download :

Friday 12 April 2019

Scatter Plots in R Language

Scatterplots show many points plotted in the Cartesian plane. Each point represents the values of two variables. One variable is chosen in the horizontal axis and another in the vertical axis.

The simple scatterplot is created using the plot()function.


The basic syntax for creating scatterplot in R is −

plot(x, y, main, xlab, ylab, xlim, ylim, axes)
Following is the description of the parameters used −

x is the data set whose values are the horizontal coordinates.

y is the data set whose values are the vertical coordinates.

main is the tile of the graph.

xlab is the label in the horizontal axis.

ylab is the label in the vertical axis.

xlim is the limits of the values of x used for plotting.

ylim is the limits of the values of y used for plotting.

axes indicates whether both axes should be drawn on the plot.


We use the data set "mtcars" available in the R environment to create a basic scatterplot. Let's use the columns "wt" and "mpg" in mtcars.

input <- mtcars[,c('wt','mpg')] print(head(input))
When we execute the above code, it produces the following result −

wt mpg Mazda RX4 2.620 21.0 Mazda RX4 Wag 2.875 21.0 Datsun 710 2.320 22.8 Hornet 4 Drive 3.215 21.4 Hornet Sportabout 3.440 18.7 Valiant 3.460 18.1
Creating the Scatterplot

The below script will create a scatterplot graph for the relation between wt(weight) and mpg(miles per gallon).

# Get the input values. input <- mtcars[,c('wt','mpg')] 
# Give the chart file a name. png(file = "scatterplot.png") 
# Plot the chart for cars with weight between 2.5 to 5 and mileage between 15 and 30. plot(x = input$wt,y = input$mpg, xlab = "Weight", ylab = "Milage", xlim = c(2.5,5), ylim = c(15,30), main = "Weight vs Milage" )
 # Save the file. dev.off()
When we execute the above code, it produces the following result −

Scatterplot Matrices

When we have more than two variables and we want to find the correlation between one variable versus the remaining ones we use scatterplot matrix. We use pairs() function to create matrices of scatterplots.


The basic syntax for creating scatterplot matrices in R is −

pairs(formula, data)
Following is the description of the parameters used −

formula represents the series of variables used in pairs.

data represents the data set from which the variables will be taken.


Each variable is paired up with each of the remaining variable. A scatterplot is plotted for each pair.

# Give the chart file a name. png(file = "scatterplot_matrices.png") # Plot the matrices between 4 variables giving 12 plots. 
# One variable with 3 others and total 4 variables. pairs(~wt+mpg+disp+cyl,data = mtcars, main = "Scatterplot Matrix") # Save the file. dev.off()
When the above code is executed we get the following output.

Popular Posts


AI (24) Android (24) AngularJS (1) Assembly Language (2) aws (17) Azure (7) BI (10) book (4) Books (101) C (77) C# (12) C++ (82) Course (60) Coursera (169) coursewra (1) Cybersecurity (22) data management (9) Data Science (73) Data Strucures (6) Deep Learning (9) Django (6) Downloads (3) edx (2) Engineering (14) Excel (13) Factorial (1) Finance (5) flutter (1) FPL (17) Google (17) Hadoop (3) HTML&CSS (46) IBM (19) IoT (1) IS (25) Java (92) Leet Code (4) Machine Learning (39) Meta (18) MICHIGAN (4) microsoft (3) Pandas (3) PHP (20) Projects (29) Python (702) Python Coding Challenge (136) Questions (2) R (70) React (6) Scripting (1) security (3) Selenium Webdriver (2) Software (17) SQL (38) UX Research (1) web application (8)


Person climbing a staircase. Learn Data Science from Scratch: online program with 21 courses