R Programming for Beginners: Understanding Data Frames, Factors, & Strings

R Programming    |    Beginner
  • 14 videos | 1h 53m 4s
  • Includes Assessment
  • Earns a Badge
Rating 4.2 of 18 users Rating 4.2 of 18 users (18)
Data frames are an R abstraction for tabular data similar to that contained in spreadsheet files or database tables. Data frames can work directly with files in the CSV, JSON, and Excel format, all common formats used to store data. This course outlines the characteristics of data frames in the R programming language and demonstrates how to use them. You'll learn to create basic R data frames from multiple vectors. You'll use factors - similar to enums or enumerated types in other programming languages and great for categorical variables. You'll also learn how to perform various string manipulation operations, such as splitting and joining strings and changing case. You'll then practice the important topic of printing precisely formatted strings with placeholders for variable values. When you're done, you'll be able to use data frames, factors, and strings professionally in your R programming projects.

WHAT YOU WILL LEARN

  • Discover the key concepts covered in this course
    Create data frames to store data as indexed rows and columns
    Label the rows in data frames and view statistics
    Index into the individual values stored in cells in data frames
    Filter data frames to view rows that satisfy a condition
    Combine two data frames using the rbind() and cbind() functions
    Implement various join operations on data frames using merge()
  • Use factors to limit the allowed values in a variable
    Recall how string values can be set to be factors in data frames
    Create factors and filter data and use the tapply() and split() functions
    Use tables to view counts of rows with specific values for fields
    Perform operations on strings, such as combining and splitting strings
    Format strings using formatc() and print data with placeholders using sprintf()
    Summarize the key concepts covered in this course

IN THIS COURSE

  • 2m 20s
    In this video, you’ll learn more about the instructor and the course. In this course, you’ll learn how to create basic R data frames from multiple vectors. You’ll learn how a data frame is an abstraction for tabular data, with named columns of different types. You’ll work with data frames to access individual rows, columns, and values, and explore various filter operations, combining data frames horizontally and vertically. FREE ACCESS
  • 9m 20s
    In this video, you’ll learn more about R data frames. Because of the explosion in popularity of Python, R data frames have become more prominent. Panda's data frame, which is used heavily in Python data programming, is inspired by the R data frame. In R, a data frame is a two-dimensional data structure. These are similar to a matrix, but every column can have a different mode. Every column can have its own data type. FREE ACCESS
  • Locked
    3.  Naming R Data Frame Dimensions & Viewing Statistics
    8m 16s
    In this video, you’ll watch a demo. You’ll pick up where you left off in the last demo and continue performing operations on data frames. You’ll create a new data frame variable called students.dataframe. Onscreen, you’ll see this is done in the same fashion as in the previous demo. You've passed in various constituent vectors, and specified stringsAsFactors equal to FALSE. FREE ACCESS
  • Locked
    4.  Indexing into R Data Frames
    11m 43s
    In this video, you’ll watch a demo. In this video, you’ll continue to explore frames in R. You’ll turn your attention from aggregate top-level properties such as head, tail, summary length, nrow, and ncol to more individual data items. You’ll see how these can be accessed using different types of indexing. Onscreen, you’ll see how to perform your first indexing operation using the double square brackets operator. FREE ACCESS
  • Locked
    5.  Filtering Data in R Data Frames
    7m 24s
    In this video, you’ll watch a demo. In this demo, you’ll continue with your exploration of data frames. You’ll define a new data frame. You can see the code for this is onscreen now. This data frame is intended to hold employee data. You’ll see the data.frame function has been invoked and you’ve passed in the various columns in the form of vectors associated with the column names. FREE ACCESS
  • Locked
    6.  Combining R Data Frames
    10m 37s
    In this video, you’ll watch a demo. In this demo, you’ll turn your attention to adding rows and columns to an existing data frame. You’ve already set up a variable called employee.data. Now, you’ll create a new variable called employee.mark. This will hold information for one new row, which you’ll add on to your existing data frame. This variable is not a data frame, it's simply a list. FREE ACCESS
  • Locked
    7.  Joining R Data Frames
    6m 7s
    In this video, you’ll watch a demo. In this demo, you’ll learn to combine data in different data frames using merge. These are join operations, so they are fundamentally different from the C bind and R bind operations you experimented with in the last demo. You’ll begin by creating a new DataFrame called employee.professional.data. You’ll see this onscreen now. It's got four columns, id, name, department, and salary. FREE ACCESS
  • Locked
    8.  Using Factors in R to Limit Variable Values
    8m 11s
    In this video, you’ll watch a demo. In this demo, you’ll work with factors in R. A factor can be thought of as the categorical variable, similar to an enum in other programming languages. You’ll start with a simple example. Onscreen you’ll see a vector called gender. This vector has values Male, Female, Male, Female, and Female. Each of these is a string, which in R is represented as the character type. FREE ACCESS
  • Locked
    9.  Creating R Data Frames with Factors
    7m 51s
    In this video, you’ll watch a demo. In this demo, you’ll pick up where you left off at the end of the last demo. You learned how a variable can be converted into type factor, now you’ll see how the levels of a factor can be accessed. First, you’ll demonstrate the space-saving you get when you use factors rather than strings. You’ll create a large vector called gender.char. FREE ACCESS
  • Locked
    10.  Using Factors with tapply() and split() in R
    9m 39s
    In this video, you’ll watch a demo. In this demo, you’ll continue working with factors in the context of data frames. You learned to create columns in a data frame, which represented factors. You also learned to include in that same data frame, other string columns, which were not encoded as factors. Now, you’ll learn to eliminate unwanted levels from a factor in our data frame. Onscreen you’ll see a variable called employee.data.subset. FREE ACCESS
  • Locked
    11.  Viewing Counts Using Tables in R
    11m 17s
    In this video, you’ll watch a demo. In this demo, you’ll learn how to view counts using tables in R. You’ll learn there’s a specific R class called table which helps with this task. A table is also known as a contingency table, or a crosstab, or cross-tabulation table. Given more than one categorical variable, you’ll get a quick sense of how many rows you have for each combination of categories using the table object. FREE ACCESS
  • Locked
    12.  Working with Strings in R
    9m 10s
    In this video, you’ll watch a demo. In this demo, you’ll learn more about strings. Strings are an important part of any programming language, particularly in production environments, because you will often need your output formatted specifically. First, you’ll learn how to define a string variable. Onscreen, you’ll see the variable is called some string, and you can see it contains the value. Strings are typically specified using double quotes. FREE ACCESS
  • Locked
    13.  Using formatC() & sprintf() in R
    8m 55s
    In this video, you’ll watch a demo. In this demo, you’ll continue working with R strings. You’ll recall strings in R are different than strings in languages like Python. You cannot index into a string to access individual characters. We cannot concatenate strings using the plus operator, you must rely on built-in functions rather than on class methods to perform operations such as substring or string split. FREE ACCESS
  • Locked
    14.  Course Summary
    2m 14s
    In this video, you’ll summarize what you’ve learned in the course. You’ve learned how to create basic R Data Frames from multiple vectors. You used data frames to access individual rows, columns, and values, and assign names and perform simple operations. You learned to perform various filter operations on data frames and combine data frames horizontally and vertically. You learned to use factors, which are similar to enums or enumerated types in other programming languages. FREE ACCESS

EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE

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.

PEOPLE WHO VIEWED THIS ALSO VIEWED THESE

Rating 4.6 of 34 users Rating 4.6 of 34 users (34)
Rating 4.4 of 11 users Rating 4.4 of 11 users (11)
Rating 4.6 of 236 users Rating 4.6 of 236 users (236)