# Blog Archives

## Using apply() to create a unique id

February 6, 2012
By

Suppose you have a data set with two identifiers. For example, maybe you're studying the relationships among firms in an industry and you have a way to link the firms to one another. Each firm has an id, but the unique unit in your data set is a pair...

Read more »

## Splitting Vectors of Uneven Strings

July 29, 2011
By

Suppose you have a vector of names such that the first three words in the vector contain relevant information, but there is a bunch of extraneous stuff. For example,Our goal is to collapse the first three words into one contiguous string (without the ...

Read more »

## Avoiding Loops in R: An Example with Principal Minors

July 18, 2011
By

Yesterday, I found myself wanting to compute a large subset of the second order principal minors of a matrix (diagonal-preserving minors; the ones for which the rows and columns kept are the same). Don't judge me for wanting to do this, and bear with ...

Read more »

## Today’s Assignment: Assignment

June 20, 2011
By

A new R user quickly discovers that there are multiple ways to store information into an object -- the technical term for this is assignment. There's = as in:x = c(1,2,3)and there's <- as in:x <- c(1,2,3)R help on assignOps offers this explanati...

Read more »

## An application of aggregate() and merge()

June 5, 2011
By

Today, I encountered an interesting problem while processing a data set of mine. My data have observations on businesses that are repeated over time. My data set also contains information on longitude and latitude of the business location, but unfort...

Read more »

## Recreational R: Simulating a Card Trick

May 30, 2011
By

In this post, I simulate an interesting card trick, which was described by a friend of mine named Xan. Here's Xan's description of the card trick:I put a deck of cards down face up on the table. Meanwhile you think of a secret number between 1 and 1...

Read more »

## Recreational R: Simulating a Card Trick

May 30, 2011
By

In this post, I simulate an interesting card trick, which was described by a friend of mine named Xan. Here's Xan's description of the card trick:I put a deck of cards down face up on the table. Meanwhile you think of a secret number between 1 and 1...

Read more »

## An Application of boot() to IV regression

May 28, 2011
By

Bootstrapping standard errors can be a useful technique when obtaining closed form for the standard error formula is difficult or intractable. In this post, I give an example of how to use R to create a bootstrap sampling distribution in the context o...

Read more »

## An Application of boot() to IV regression

May 28, 2011
By

Bootstrapping standard errors can be a useful technique when obtaining closed form for the standard error formula is difficult or intractable. In this post, I give an example of how to use R to create a bootstrap sampling distribution in the context o...

Read more »

## Defaults, Lists and Classes: A Functional Post

May 20, 2011
By

In this post, I demonstrate a couple of useful tricks to writing functions in R. The context is a function I wrote called called samp() that allows for an easy demonstration of sampling distribution properties.DefaultsBy default, this function draws K...

Read more »

## Sponsors

Contact us if you wish to help support R-bloggers, and place your banner here.

# Never miss an update! Subscribe to R-bloggers to receive e-mails with the latest R posts.(You will not see this message again.)

Click here to close (This popup will not appear again)