R Programming for Beginners: Understanding Data Frames, Factors, & Strings
R Programming
| Beginner
- 14 videos | 1h 53m 4s
- Includes Assessment
- Earns a Badge
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 courseCreate data frames to store data as indexed rows and columnsLabel the rows in data frames and view statisticsIndex into the individual values stored in cells in data framesFilter data frames to view rows that satisfy a conditionCombine two data frames using the rbind() and cbind() functionsImplement various join operations on data frames using merge()
-
Use factors to limit the allowed values in a variableRecall how string values can be set to be factors in data framesCreate factors and filter data and use the tapply() and split() functionsUse tables to view counts of rows with specific values for fieldsPerform operations on strings, such as combining and splitting stringsFormat strings using formatc() and print data with placeholders using sprintf()Summarize the key concepts covered in this course
IN THIS COURSE
-
2m 20sIn 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 20sIn 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
-
8m 16sIn 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
-
11m 43sIn 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
-
7m 24sIn 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
-
10m 37sIn 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
-
6m 7sIn 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
-
8m 11sIn 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
-
7m 51sIn 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
-
9m 39sIn 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
-
11m 17sIn 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
-
9m 10sIn 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
-
8m 55sIn 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
-
2m 14sIn 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.