Performing linear regression with R

Linear regression is a common technique to find the best fit straight line in a scatter plot. The resulting line can help in predictive analysis.

In this recipe, we will add trend lines to CO2 Emission graphs using R:

Performing linear regression with R

Getting ready

This recipe has a few prerequisites before it can be followed:

  1. Install R. The R Project for Statistical Computing website is https://www.r-project.org/.
  2. Optionally, install RStudio from https://www.rstudio.com/, which is an integrated environment for R.
  3. Install the Rserve package by running the following in R:
      install.packages("Rserve"); 
      library(Rserve);
    run.Rserve();
  4. You will get a message ...

Get Tableau 10 Business Intelligence Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.