Datasets in R: Transforming Data

R Programming 4.0+    |    Intermediate
  • 14 videos | 1h 58m 53s
  • Includes Assessment
  • Earns a Badge
Likes 10 Likes 10
Organizations store data in various ways. The R programming language offers a straightforward interface to work with data in relational databases and transform it to the format you need for analysis. In this course, you'll learn how to connect to relational databases using the APIs provided in the Database Interface package (DBI) in R. You'll connect to SQLite data and perform create, read, update, and delete (CRUD) operations on your database tables. You'll also use R functions to mutate and transform data. You'll practice renaming columns, changing variable types, and creating new columns from derived data. You'll examine the tidyverse universe of data science packages and work with data in the wide and long formats. Once you've completed this course, you'll have a strong foundation in basic data manipulation and transformation using the R programming language.


  • discover the key concepts covered in this course
    connect to an in-memory SQLite database and create tables
    query database tables with dbGetQuery() and dbSendQuery()
    perform create, read, update, and delete operations on tables
    delete and rename columns in an R data frame
    change data types for variables in a data frame
    use the transform() function to transform data in data frames
  • use apply() to iterate over and perform operations on data frames
    apply transformations on dataframes using mutate() and if_else()
    use the stack() and unstack() functions to reformat data frames
    use the melt() and dcast() functions to reformat data frames
    reformat a real-world dataset
    use spread() and gather() to reformat data frames
    summarize the key concepts covered in this course


  • 2m 5s
    In this video, you’ll learn more about the course and your instructor. In this course, you’ll learn to connect to relational databases using the APIs provided in the DBI or Database Interface Package in R. DBI offers a unified set of APIs for use with relational databases, separating the interface and the implementation of data access. You’ll connect to SQLite databases and run queries and perform create, read, update, and delete operations on database tables. FREE ACCESS
  • 9m 9s
    In this video, you’ll watch a demo. In this demo, you’ll learn how to access your data. You’ll learn R provides packages that allow you to integrate with your relational database. They also allow you to load in your data and run SQL queries on that data. This is what you’ll explore in this demo. Onscreen, you’ll see R code has been written in a brand new script file called LoadingDataFromSQLite. FREE ACCESS
  • Locked
    3.  Connecting to and Retrieving Results from SQLite
    11m 1s
    In this video, you’ll watch a demo. You’ll see the most natural way to load data from a database table is by running SQL queries. You’ll learn to use the DBI API along with RSQLite to run SQL queries to retrieve data. The function you’ll invoke is the dbGetQuery function in the DBI package. dbGetQuery will send the query you’ve specified to your underlying database table. This retrieves the results and clear the result set. FREE ACCESS
  • Locked
    4.  Updating Results with a Persistent Database
    11m 20s
    In this video, you’ll watch a demo. You’ll learn how to connect to a persistent SQLite database. The data stored in your database tables will be in a file on your local machine. First, you’ll set up a connection to this database. You’ll use the dbConnect function to establish a database connection, RSQLite::SQLite. This is the database you’ll connect to, and the name of the database is animals.db. FREE ACCESS
  • Locked
    5.  Dropping and Renaming Columns
    7m 20s
    In this video, you’ll watch a demo. You’ll learn to load datasets from files and SQL tables, or relational tables, into your R program. First, you’ll learn some of the operations you can perform in R to transform data held in data frames. First, you’ll run the rm list = ls command to remove the objects stored in memory in this R environment. This clears previously created variables and the memory allocated to them. FREE ACCESS
  • Locked
    6.  Changing Column Data Types
    9m 50s
    In this video, you’ll watch a demo. You’ll learn statistical analysis can manipulate and clean up data so it's ready for analysis. This means data frame manipulations must be easy and intuitive. This is why you have the dplyr package. The dplyr package is an R package that provides a set of tools for manipulating data frames using verbs. The dplyr package works with any data frame, which means it works with tibbles, too. FREE ACCESS
  • Locked
    7.  Transforming Data Using the Transform Function
    5m 54s
    In this video, you’ll watch a demo. You’ll learn to create a new column by deriving information from another column that already exists in your data. You’ll learn different techniques, which are part of the base package in R, as well as the dplyr package to perform such transformations. You’ll first turn your attention to the age column. This age column gives you the age of the customer. FREE ACCESS
  • Locked
    8.  Transforming Data Using the Apply Function Family
    13m 7s
    In this video, you’ll watch a demo. You’ll explore some of the members of the apply Family of Functions. You’ll learn the apply family comprises different functions. There are family of functions in base R which allow you to repetitively perform an action on multiple chunks of data. An apply function runs far faster than loops do and often requires less code to write. Here, you’ll explore the apply and the mapply functions. FREE ACCESS
  • Locked
    9.  Transforming Data Using if_else() and mutate()
    11m 44s
    In this video, you’ll watch a demo. You’ll explore the ifelse function that allows you to transform data based on a condition. You’ll also explore the mutate function for data transformation, which is part of the dplyr package. You’ll see the ifelse function allows you to perform data transformation actions based on a condition you specify as an expression. FREE ACCESS
  • Locked
    10.  Wide Form and Long Form: Using stack() and unstack()
    10m 32s
    In this video, you’ll watch a demo. You’ll see different techniques you can use to go from wide form data to long form, and from long form data to wide form. This transformation of data from wide form to long form and back is important because certain kinds of analysis might require your data to be in a particular form. You’ll need to be able to convert it to any form when needed. FREE ACCESS
  • Locked
    11.  Wide Form and Long Form: Using melt() and dcast()
    7m 36s
    In this video, you’ll watch a demo. You’ll look at the melt and dcast functions. The melt and dcast functions are available as a part of the reshape2 package. You’ll use the reshape2 package to see how to use the melt and dcast functions to perform a wide format to long format conversions. In this demo, you’ll use the melt function to convert data to the long format. FREE ACCESS
  • Locked
    12.  melt() and dcast() on a Real Dataset
    6m 51s
    In this video, you’ll watch a demo. You’ll use the melt and dcast operation on a real dataset that’s read in from a CSV file. The dataset you’ll use is in the datasets folder. This is the U.S._crude_oil_production.csv file. When you view this file, you’ll see it contains data in wide format. You’ll see an overview of the data you’ll be working with. You’ll read the contents of the CSV file into a data frame. FREE ACCESS
  • Locked
    13.  Wide Form and Long Form: Using gather() and spread()
    9m 58s
    In this video, you’ll watch a demo. You’ll see how to convert byte form data to the long format and vice versa using the tidyr package. You’ve used the tidyverse universe of packages earlier in the course. The tidyverse universe comprises of a collection of data science packages. They have their own grammar and data manipulation techniques and make working with data simple. One package in this universe is the tidyr package. FREE ACCESS
  • Locked
    14.  Course Summary
    2m 28s
    In this video, you’ll summarize what you’ve learned in this course. You’ve learned basic transformation and manipulation operations on data stored in R data frames. You learned to use the database interface package in R to connect to and query relational databases. You explored how to query data stored in tables using functions such as dbGetQuery and dbSendQuery and performed CRUD or create, read, update and delete operations on data stored in tables. FREE ACCESS


Skillsoft is providing you the opportunity to earn a digital badge upon successful completion on some of our courses, which can be shared on any social network or business platform.

Digital badges are yours to keep, forever.