Search for tag: "programming"

Vectorized Computations.mp4

In R, loops are often not the most efficient way to do repetitive calculations. Rather than doing the calculations for each value of a variable it is much more efficient to organize the values of…

From  Daniel Hall 65 plays 0  

Repetitive Execution - Part 2 (repeat and while Loops)

In this video we introduce the repeat and while loops. There are small differences in the syntax of the three types of loops in R, which may make one form more convenient than another in any given…

From  Daniel Hall 146 plays 0  

Repetitive Execution - Part 1 (for Loops)

Loops are a basic element of all computer programming. In R, loops are somewhat less necessary than in many other languages because R can do vectorized calculations---calculations on all of the…

From  Daniel Hall 86 plays 0  

Conditional Execution - Part 2 (The if Statement).mp4

Conditional execution is a fundamental technique in all computer programming and most computing languages have an if statement. The if and if else statements in R are similar to those in other…

From  Daniel Hall 68 plays 0  

Conditional Execution - Part 1 (The ifelse() Function).mp4

The ifelse() function evaluates a logical object (usually a vector-valued logical condition) and returns an object of the same dimension with TRUE values replaced by a value, or vector of values,…

From  Daniel Hall 172 plays 0  

Grouped Expressions.mp4

A grouped expression is a collection of R commands or expressions enclosed in curly brackets {}. R regards a grouped expression as a single expression with a single value, although when such an…

From  Daniel Hall 107 plays 0  

Repeatedly Applying Functions to Data - Part 2 (lapply() and sapply())

While tapply() applies a function to different observations in a vector, which might correspond to rows in a data frame, lapply() and sapply() apply a function to each element of a list. In the case…

From  Daniel Hall 199 plays 0  

Data Structures in R - Part 4, Lists.mp4

We continue to discuss data structures in R, this time focusing on lists. Unlike vectors, matrices and arrays, the elements of a list may be of different modes. This makes them very flexible and…

From  Daniel Hall 90 plays 0  

Data Structures in R - Part 3, Arrays.mp4

We continue to discuss data structures in R, this time focusing on arrays. An array is a generalization of a matrix with an arbitrary number of dimensions. We illustrate the structure with a three…

From  Daniel Hall 150 plays 0  

Introduction to R - Part 2 (Scripts and RStudio)

RStudio provides a more convenient programming environment for working with R. We introduce the RStudio and show how to work from a script within RStudio. The script that we focus on is…

From  Daniel Hall 708 plays 0  

Introduction to R - Part 1 (CRAN and Using the R Console)

In this video we introduce R. We give a brief overview of what R is; introduce CRAN (the Comprehensive R Archive Network website) and show how to find installation files, packages and documentation;…

From  Daniel Hall 574 plays 0  

The ODS System - Part 3 (The ODS Output Statement)

In this video we demonstrate the ODS OUTPUT statement with an example involving PROC FREQ and compare it to the OUT= option on the TABLES statement. PROC FREQ, PROC MEANS and several other SAS PROCs…

From  Daniel Hall 431 plays 0  

PROC TRANSPOSE - Part 2 (Transposing Variables into Observations)

In this video we show how to transpose variables (columns) into observations (rows) with PROC TRANSPOSE. We illustrate by converting a longitudinal data set from wide format to tall format. This can…

From  Daniel Hall 446 plays 0  

The Output Statement - Part 4 (FEV Example, Revisited)

In this video we return to the FEV Example and show how the OUTPUT statement, in conjunction with a Sum statement, can be used to compute and store posttest-pretest differences even when the posttest…

From  Daniel Hall 186 plays 0  

Introduction to the OUTPUT Statement

Several SAS PROCs have an OUTPUT statement. But here we discuss the OUTPUT statement in a data step. It is used to write the current observation (the contents of the Program Data Vector) to a data…

From  Daniel Hall 231 plays 0  

The SET Statement - Part 3, the FIRST. and LAST. Variables

When setting a data set, the BY statement can be used to generate special variables known as the FIRST. and LAST. variables. These variables, which are only available in the program data vector, mark…

From  Daniel Hall 158 plays 0