R Programming Fundamentals

Book description

Study data analysis and visualization to successfully analyze data with R

Key Features

  • Get to grips with data cleaning methods
  • Explore statistical concepts and programming in R, including best practices
  • Build a data science project with real-world examples

Book Description

R Programming Fundamentals, focused on R and the R ecosystem, introduces you to the tools for working with data. To start with, you'll understand you how to set up R and RStudio, followed by exploring R packages, functions, data structures, control flow, and loops.

Once you have grasped the basics, you'll move on to studying data visualization and graphics. You'll learn how to build statistical and advanced plots using the powerful ggplot2 library. In addition to this, you'll discover data management concepts such as factoring, pivoting, aggregating, merging, and dealing with missing values.

By the end of this book, you'll have completed an entire data science project of your own for your portfolio or blog.

What you will learn

  • Use basic programming concepts of R such as loading packages, arithmetic functions, data structures, and flow control
  • Import data to R from various formats such as CSV, Excel, and SQL
  • Clean data by handling missing values and standardizing fields
  • Perform univariate and bivariate analysis using ggplot2
  • Create statistical summary and advanced plots such as histograms, scatter plots, box plots, and interaction plots
  • Apply data management techniques, such as factoring, pivoting, aggregating, merging, and dealing with missing values, on the example datasets

Who this book is for

R Programming Fundamentals is for you if you are an analyst who wants to grow in the field of data science and explore the latest tools.

Table of contents

  1. Title Page
  2. Copyright and Credits
    1. R Programming Fundamentals
  3. Packt Upsell
    1. Why Subscribe?
    2. Packt.com
  4. Contributors
    1. About the Author
    2. Packt is Searching for Authors Like You
  5. Preface
    1. Who This Book is for
    2. What This Book Covers
    3. To Get the Most Out of This Book
      1. Download the Example Code Files
      2. Conventions Used
    4. Get in Touch
      1. Reviews
  6. Introduction to R
    1. Using R and RStudio, and Installing Useful Packages
      1. Using R and RStudio
        1. Executing Basic Functions in the R Console
        2. Setting up a New Project 
      2. Installing Packages
      3. Activity: Installing the Tidyverse Packages
    2. Variable Types and Data Structures
      1. Variable Types
        1. Numeric and Integers
        2. Character
        3. Dates
      2. Activity: Identifying Variable Classes and Types
      3. Data Structures
        1. Vectors
        2. Lists
        3. Matrices
        4. Dataframes
      4. Activity: Creating Vectors, Lists, Matrices, and Dataframes
    3. Basic Flow Control
      1. If/else
      2. For loop
      3. While loop
      4. Activity: Building Basic Loops
    4. Data Import and Export
      1. Excel Spreadsheets
      2. Activity: Exporting and Importing the mtcars Dataset
    5. Getting Help with R
      1. Package Documentation and Vignettes
      2. Activity: Exploring the Introduction to dplyr Vignette
      3. RStudio Community, Stack Overflow, and the Rest of the Web
    6. Summary
  7. Data Visualization and Graphics
    1. Creating Base Plots
      1. The plot() Function
        1. Factor Variables
        2. Model Objects
          1. Plotting More Than One Plot at a Time
          2. Creating and Plotting a Linear Model Object
        3. Titles and Axis Labels
          1. Changing the Color of Base Plots
      2. Activity: Recreating Plots with Base Plot Methods
    2. ggplot2
      1. ggplot2 Basics
        1. Histogram
          1. Creating Histograms using ggplot2
        2. Bar Chart
          1. Creating a Bar Chart with ggplot2 using Two Different Methods
        3. Scatterplot
          1. Creating a Scatterplot of Two Continuous Variables
        4. Boxplot
          1. Creating Boxplots using ggplot2
      2. Activity: Recreating Plots Using ggplot2
      3. Digging into aes()
        1. Bar Chart
          1. Using Different Bar Chart Aesthetic Options
        2. Facet Wrapping and Gridding
          1. Utilizing Facet Wrapping and Gridding to Visualize Data Effectively
        3. Boxplot + coord_flip()
        4. Scatterplot
          1. Utilizing Different Aesthetics for Scatterplots, Including Shapes, Colors, and Transparencies
      4. Activity: Utilizing ggplot2 Aesthetics
      5. Extending the Plots with Titles, Axis Labels, and Themes
    3. Interactive Plots
      1. Plotly
      2. Shiny
      3. Exploring Shiny and Plotly
    4. Summary
  8. Data Management
    1. Factor Variables
      1. Creating Factor Variables in a Dataset
        1. Using ifelse() Statements
        2. Using the recode() Function
      2. Examining and Changing the Levels of Pre-existing Factor Variables
      3. Creating an Ordered Factor Variable
      4. Activity: Creating and Manipulating Factor Variables
    2. Summarizing Data
      1. Data Summarization Tables
        1. Tables in R
          1. Creating Different Tables Using the table() Function
          2. Using dplyr Methods to Create Data Summary Tables
      2. Activity: Creating Data Summarization Tables
      3. Summarizing Data with the Apply Family
        1. Using the apply() Function to Create Numeric Data Summaries
      4. Activity: Implementing Data Summary
    3. Splitting, Combining, Merging, and Joining Datasets
      1. Splitting and Combining Data and Datasets
        1. Splitting and Unsplitting Data with Base R and the dplyr Methods
        2. Splitting Datasets into Lists and Then Back Again
        3. Combining Data
        4. Combining Data with rbind()
        5. Combining Matrices of Objects into Dataframes
        6. Splitting Strings
        7. Using stringr Package to Manipulate a Vector of Names
        8. Combining Strings Using Base R Methods
      2. Activity: Demonstrating Splitting and Combining Data
      3. Merging and Joining Data
        1. Demonstrating Merges and Joins in R
      4. Activity: Merging and Joining Data
    4. Summary
  9. Solutions
    1. Chapter 1: Introduction to R
      1. Activity: Installing the Tidyverse Packages
      2. Activity: Identifying Variable Classes and Types
      3. Activity: Creating Vectors, Lists, Matrices, and Dataframes
      4. Activity: Building Basic Loops
      5. Activity: Exporting and Importing the mtcars Dataset
      6. Activity: Exploring the Introduction to dplyr Vignette
    2. Chapter 2: Data Visualization and Graphics
      1. Activity: Recreating Plots with Base Plot Methods
      2. Activity: Recreating Plots Using ggplot2
      3. Activity: Utilizing ggplot2 Aesthetics
    3. Chapter 3: Data Management
      1. Activity: Creating and Manipulating Factor Variables
      2. Activity: Creating Data Summarization Tables
      3. Activity: Implementing Data Summary
      4. Activity: Demonstrating Splitting and Combining Data
      5. Activity: Merging and Joining Data
  10. Other Books You May Enjoy
    1. Leave a Review - Let Other Readers Know What You Think

Product information

  • Title: R Programming Fundamentals
  • Author(s): Kaelen Medeiros
  • Release date: September 2018
  • Publisher(s): Packt Publishing
  • ISBN: 9781789612998