Categories

The Comprehensive Programming in R Course

Please confirm that you want to add **The Comprehensive Programming in R Course** to your Wishlist.

How to design and develop efficient general-purpose R applications for diverse tasks and domains.

2,176 students enrolled

Curiosity Sale

Current price: $10
Original price: $60
Discount:
83% off

30-Day Money-Back Guarantee

- 25 hours on-demand video
- 5 Supplemental Resources
- Full lifetime access
- Access on mobile and TV

- Certificate of Completion

What Will I Learn?

- Acquire the skills needed to successfully develop general-purpose programming applications in the R environment
- Possess an in-depth understanding of the R programming environment and of the requirements for, and programming implications of, writing code using basic R objects: vectors, matrices, dataframes and lists.
- Understand the object-oriented characteristics of programming in R and know how to create S3 and S4 Class objects and functions that process these S3 and S4 objects.
- Know how to program mathematical functions, models and simulations in R.
- Know how to write R programs that effectively use and manipulate text and string variable objects.
- Know how to use the scan(), readline(), cat(), print() and readLines() functions in R for efficient data input and output and for effective user-prompting.
- Know how to 'tweak' R programs for maximum performance efficiency.

Requirements

- Students will need to install the no-cost R console and the no-cost RStudio application (instructions are provided).

Description

* The Comprehensive Programming in R Course* is actually a combination of two R programming courses that together comprise a gentle, yet thorough introduction to the practice of general-purpose application development in the R environment. The original first course (Sections 1-8) consists of approximately 12 hours of video content and provides extensive example-based instruction on details for programming R data structures. The original second course (Sections 9-14), an additional 12 hours of video content, provides a comprehensive overview on the most important conceptual topics for writing efficient programs to execute in the unique R environment. Participants in this comprehensive course may already be skilled programmers (in other languages) or they may be complete novices to R programming or to programming in general, but their common objective is to write R applications for diverse domains and purposes. No statistical knowledge is necessary. These two courses, combined into one course here on Udemy, together comprise a thorough introduction to using the R environment and language for general-purpose application development.

**The Comprehensive Programming in R Course** (Sections 1-8) presents an detailed, in-depth overview of the R programming environment and of the nature and programming implications of basic R objects in the form of vectors, matrices, dataframes and lists.

Who is the target audience?

- Anyone interested in writing computer applications that execute in the R environment.
- The common objective of students is common objective is to write R applications for diverse domains and purposes.
- Students may already be skilled programmers (in other languages) or they may be complete novices to R programming or to programming in general,
- Undergraduate or graduate students looking to acquire marketable job skills prior to graduation.
- Analytics professionals looking to acquire additional job skills.

Students Who Viewed This Course Also Viewed

Curriculum For This Course

120 Lectures

24:59:32
+
–

Introduction and Overview of R
14 Lectures
02:54:11

Introduction and Getting Started

14:54

Getting Started and First R Session

14:53

First R Session (part 3)

15:08

Matrices, Lists and Dataframes

14:58

One of the great strengths of **R** is the user's ability to add functions. In fact, many of the functions in **R**are actually functions of functions. The structure of a function is given below.

`myfunction <- function(arg1, arg2, ... )`

`{statements}`

Objects in the function are local to the function.

Introduction to Functions

15:02

Functions and Default Arguments

14:49

More Examples of Functions (part 1)

14:17

More Functions Examples (part 2)

12:00

More Functions Examples (part 3)

11:12

More Functions Examples (part 4)

12:25

More Functions Examples (part 5)

10:19

More Functions Examples (part 6)

07:31

+
–

What are Vector Data Structures in R ?
6 Lectures
01:28:49

Homemade t-test Exercise Solution

15:50

Section 2 Exercise and Package Demonstrations

14:23

A **vector **is a sequence of data elements of the same basic type. Members in a vector are officially called **components**. Nevertheless, they are often called **elements**.

Preview
15:30

More Examples of Vectors

14:36

Common Vector Operations and More

14:18

Findruns Example and Vectors Exercises

14:12

+
–

More Discussion of Vector Data Structures
6 Lectures
01:29:38

Vector-Based Programming Exercise Solution (part 1)

14:46

Vector Exercise Solution (part 2) and Begin General Vector Discussion

16:05

More General Vector Examples

12:56

More on Vectors and Vector Equality

16:40

Extended Vector Example and Exercise

13:08

+
–

Finish Vectors and Begin Matrices
5 Lectures
01:21:25

Finish Vector Discussion

16:33

Vector-Maker Exercise Solutions

17:08

Creating matrices

The functionmatrixcreates matrices.

matrix(data, nrow, ncol, byrow)

Thedataargument is usually a list of the elements that will fill the matrix. Thenrowandncolarguments specify the dimension of the matrix. Often only one dimension argument is needed if, for example, there are 20 elements in thedatalist andncolis specified to be 4 then R will automatically calculate that there should be 5 rows and 4 columns since 4*5=20. Thebyrowargument specifies how the matrix is to be filled. The default value forbyrowis FALSE which means that by default the matrix will be filled column by column.

**seq1 <- seq(1:6) **

**mat1 <- matrix(seq1, 2) **

**mat2 <- matrix(seq1, 2, byrow = T) **

Preview
14:57

Filtering Matrices and More Examples

15:55

Still More Matrices Examples

16:52

+
–

Finish Matrices and Begin Lists Discussion
7 Lectures
01:29:03

Min-Merge Vector Exercise Solutions

15:15

Naming Matrix Rows and Columns

15:47

A **list** is an R structure that may contain object of any other types, including other lists. Lots of the modeling functions (like t.test() for the t test or lm() for linear models) produce lists as their return values, but you can also construct one yourself:

mylist <- list (a = 1:5, b = "Hi There", c = function(x) x * sin(x))

Lists: General List Operations

11:48

Applying Functions to Lists

17:32

Vector and Matrix Exercise

04:52

+
–

Continue Lists Discussion
5 Lectures
01:19:20

Review Programming Exercises

16:08

Finish Programming Exercise Review and Begin Discussing Lists

15:16

List Data Structures General Discussion (part 3)

15:46

Lists Data Structures General Discussion (part 4)

15:48

+
–

Details About Dataframe Data Structures
6 Lectures
01:29:59

Data Frames

A data frame is more general than a matrix, in that different columns can have different modes (numeric, character, factor, etc.). This is similar to SAS and SPSS datasets.

`d <- c(1,2,3,4)<br> e <- c("red", "white", "red", NA)<br> f <- c(TRUE,TRUE,TRUE,FALSE)<br> mydata <- data.frame(d,e,f)<br> names(mydata) <- c("ID","Color","Passed") # variable names`

There are a variety of ways to identify the elements of a data frame .

`myframe[3:5] # columns 3,4,5 of data frame<br> myframe[c("ID","Age")] # columns ID and Age from data frame<br> myframe$X1 # variable x1 in the data frame`

Dataframe-Maker Exercise

13:52

A **data frame** is a table, or two-dimensional array-like structure, in which each column contains measurements on one variable, and each row contains one case or sample (observation) with the corresponding values for each variable for that observation.

List-Maker Exercise; Begin General Dataframe Discussion

15:08

A Salary Survey Extended Example

16:00

Merging Dataframes

14:29

End Dataframes Discussion; Matrix Exercise

14:10

+
–

More Matrix and List Examples
7 Lectures
01:21:16

Covariance Matrix Exercise Solution

12:21

Lists

An ordered collection of objects (components). A list allows you to gather a variety of (possibly unrelated) objects under one name.

`# example of a list with 4 components - <br> # a string, a numeric vector, a matrix, and a scaler <br> w <- list(name="Fred", mynumbers=a, mymatrix=y, age=5.3)<br> <br> # example of a list containing two lists <br> v <- c(list1,list2)`

Identify elements of a list using the [[]] convention.

`mylist[[2]] # 2nd component of the list<br> mylist[["mynumbers"]] # component named mynumbers in list`

List Example: Tree Growth (part 1)

14:05

List Example: Tree Growth (part 2)

10:45

Factors

Tell **R** that a variable is **nominal **by making it a factor. The factor stores the nominal values as a vector of integers in the range [ 1... k ] (where k is the number of unique values in the nominal variable), and an internal vector of character strings (the original values) mapped to these integers.

`# variable gender with 20 "male" entries and <br> # 30 "female" entries <br> gender <- c(rep("male",20), rep("female", 30)) <br> gender <- factor(gender) <br> # stores gender as 20 1s and 30 2s and associates<br> # 1=female, 2=male internally (alphabetically)<br> # R now treats gender as a nominal variable <br> summary(gender)`

An ordered factor is used to represent an **ordinal variable**.

`# variable rating coded as "large", "medium", "small'<br> rating <- ordered(rating)<br> # recodes rating to 1,2,3 and associates<br> # 1=large, 2=medium, 3=small internally<br> # R now treats rating as ordinal`

**R** will treat factors as nominal variables and ordered factors as ordinal variables in statistical proceedures and graphical analyses. You can use options in the **factor( ) **and **ordered( )** functions to control the mapping of integers to strings (overiding the alphabetical ordering). You can also use factors to createvalue labels.

Preview
14:32

Factors: tapply() and split() Functions

15:58

1. Creating factor variables

Factor variables are categorical variables that can be either numeric or string variables. There are a number of advantages to converting categorical variables to factor variables. Perhaps the most important advantage is that they can be used in statistical modeling where they will be implemented correctly, i.e., they will then be assigned the correct number of degrees of freedom. Factor variables are also very useful in many different types of graphics. Furthermore, storing string variables as factor variables is a more efficient use of memory. To create a factor variable we use the **factor** function. The only required argument is a vector of values which can be either string or numeric. Optional arguments include the **levels** argument, which determines the categories of the factor variable, and the default is the sorted list of all the distinct values of the data vector. The **labels** argument is another optional argument which is a vector of values that will be the labels of the categories in the**levels** argument.

Factor Levels versus Values

10:58

Pascal's Triangle Exercise

02:37

+
–

Programming in R Environments
8 Lectures
01:51:59

Pascal's Triangle Exercise Solution

10:27

Begin Programming Structures

15:32

R Programming Environment and Scope

In order to write functions in a proper way and avoid unusual errors, we need to know the concept of environment and scope in R.

R Programming Environment Environment can be thought of as a collection of objects (functions, variables etc.). An environment is created when we first fire up the R interpreter. Any variable we define, is now in this environment. The top level environment available to us at the R command prompt is the global environment called `R_GlobalEnv`

. Global environment can be referred to as `.GlobalEnv`

in R codes as well. We can use the`ls()`

function to show what variables and functions are defined in the current environment. Moreover, we can use the `environment()`

function to get the current environment.

Preview
14:16

Nesting Multiple Environments

16:06

Referencing Variables in Other Frames

14:53

Writing to Global Variables and Recursion

14:05

Anonymous Functions

As remarked at several points in this book, the purpose of the R function `function()`

is to create functions. For instance, consider this code:

inc <- function(x) return(x+1)

It instructs R to create a function that adds 1 to its argument and then assigns that function to `inc`

. However, that last step—the assignment—is not always taken. We can simply use the function object created by our call to`function()`

without naming that object. The functions in that context are called *anonymous*, since they have no name. (That is somewhat misleading, since even nonanonymous functions only have a name in the sense that a variable is pointing to them.)

Replacement and Anonymous Functions

19:32

Sorting Programs Exercise

07:08

+
–

Performing Math and Simulations
8 Lectures
01:45:11

Sorting Programs Exercise Solution (part 1)

12:30

Sorting Programs Exercise Solution (part 2)

13:57

Linear Algebra Operations

17:08

Set OperationsDescription

Performs **set** union, intersection, (asymmetric!) difference, equality and membership on two vectors.

union(x, y) intersect(x, y) setdiff(x, y) setequal(x, y) is.element(el, set)Arguments

`x, y, el, set`

vectors (of the same mode) containing a sequence of items (conceptually) with no duplicated values.Details Each of `union`

, `intersect`

, `setdiff`

and `setequal`

will discard any duplicated values in the arguments, and they apply `as.vector`

to their arguments (and so in particular coerce factors to character vectors).

`is.element(x, y)`

is identical to `x %in% y`

.

Set Operations and Simulation

15:22

Combinatorial Simulations (part 1)

10:40

Combinatorial Simulations (part 2)

15:28

Winning at Roulette Exercise

07:39

4 More Sections

Frequently Bought Together

About the Instructor

Professor of Information Systems

- About Us
- Udemy for Business
- Become an Instructor
- Affiliate
- Blog
- Topics
- Mobile Apps
- Support
- Careers
- Resources

- Copyright © 2017 Udemy, Inc.
- Terms
- Privacy Policy and Cookie Policy
- Intellectual Property