- lwd – A positive number.

# Category Archives: Uncategorized

# Survival Analysis in R (‘survival’ package)

Back in grad school I created a guide for survival analysis. It takes a simple and modular layout. Each topic is contained on 1 or 2 pages, making it very easy to navigate, browse, or reference. The full set of R code is also provided on the hosting page for the guide on OpenIntro’s site:

www.openintro.org/stat/surv.php

The R package associated with the guide was also recently added to GitHub:

# Introduction to R Programming videos — data sets!

Below are links to the data sets used in the Introduction to R Programming Videos in the previous post:

# Introduction to R Programming videos

Get a thorough introduction to programming in R through 21 videos:

The full set of videos can be easily browsed in this Google+ post.

To remove any confusion: I work at YouTube, and I developed the videos as part of a 20% project. Also notice that the videos are available on YouTube under a Creative Commons license.

Thank you to the Google Developers team!

Best,

David

# Five functions I wished I had known five years ago

Like just about every other grad statistics student, my first 2-3 years of education in R programming was a bit disjoint. I’d pick up skills and learn new functions from random courses and sources. This post features five functions that I wish I’d known soon after I started programming in R but didn’t learn until 2 or more years in.

identical(x, y). Check if two R objects x and y are exactly identical.

txtProgressBar, setTxtProgressBar. Set the parameters of a progress bar using txtProgressBar, then print the progress bar in each iteration of a loop using setTxtProgressBar. Pretty much any for loop that takes more than five seconds to run would benefit from the use of these functions.

package.skeleton. Generate all the skeleton files for a package using the objects in an R session. I’ve taken to creating a package for most projects I work on to organize data and functions. If you aren’t familiar with package building, start by viewing this video guide.

by(data, INDICES, FUN, …). Apply a function across subsets of data, where the subsets are defined by the INDICES argument. The by function returns an object that summarizes each particular subset of the data according to the indices used.

traceback. If there’s an error returned from a function, use the traceback function to trace the last command run that caused the error.

Three honorable mentions: browser, rgb, and how to clear the console screen.

Consider leaving your favorites in the comments!

# fix

- x – A function to be edited.