January 2013

Regression on categorical variables

January 30, 2013 | arthur charpentier

This morning, Stéphane asked me tricky question about extracting coefficients from a regression with categorical explanatory variates. More precisely, he asked me if it was possible to store the coefficients in a nice table, with information on the variable and the modality (those two information being in two different ... [Read more...]

Approaching the Zero Bound – Bonds

January 30, 2013 | klr

As bonds approach the artificial zero bound, where do we go next especially after the record setting +30% in 2011?  The rolling 250-day total return has rarely gone negative since the inception of the Vanguard Funds VBMFX and VUSTX.  I am int...
[Read more...]

The magic empty bracket

January 30, 2013 | anspiess

I have been working with R for some time now, but once in a while, basic functions catch my eye that I was not aware of… For some project I wanted to transform a correlation matrix into a covariance matrix. Now, since cor2cov does not exist, I thought about “... [Read more...]

Speed up for loops in R

January 30, 2013 | Raymond Tse

Are your for loops too slow in R ? Are loops that should take seconds actually taking hours ? As I found out recently, how you structure your code can make a huge difference in execution times. Fortunately making a few small changes to your code can speed up these loops by ... [Read more...]

R’s range and loop behaviour: Zero, One, NULL

January 30, 2013 | msuzen

One of the most common pattern in programming languages is to ability to iterate over a given set (a vector usually) by using 'for' loops. In most modern scripting languages range operations is a build in data structure and trivial to use with 'for' lo... [Read more...]

The three-dots construct in R

January 30, 2013 | Patrick Burns

There is a mechanism that allows variability in the arguments given to R functions.  Technically it is ellipsis, but more commonly called “…”, dots, dot-dot-dot or three-dots. Basics The three-dots allows: an arbitrary number and variety of arguments passing arguments on to other functions Arbitrary arguments The two prime cases are ... [Read more...]

Using Boost’s foreach macro

January 30, 2013 | Rcpp Gallery

Boost provides a macro, BOOST_FOREACH, that allows us to easily iterate over elements in a container, similar to what we might do in R with sapply. In particular, it frees us from having to deal with iterators as we do with std::for_each and std::transform. The macro ...
[Read more...]

Converting a list to a data frame

January 30, 2013 | Jason Bryer

There are many situations in R where you have a list of vectors that you need to convert to a data.frame. This question has been addressed over at StackOverflow and it turns out there are many different approaches to completing this task. Since I encou... [Read more...]

Tracking down errors in R

January 29, 2013 | Pete

It's that moment we all know and love, somewhere in our code something has gone wrong. We think we have done everything right, but instead of expected glory we find only terse red text lain below our lintel. This can be very frustrating, and trouble shooting these issues can often ... [Read more...]

Another Benchmark for Joining Two Data Frames

January 29, 2013 | statcompute

In my post yesterday comparing efficiency in joining two data frames, I overlooked the computing cost used to convert data.frames to data.tables / ff data objects. Today, I did the test again with the consideration of library loading and data conversion. After the replication of 10 times in rbenchmark package, ... [Read more...]

Strata’s Data Driven Business Day

January 29, 2013 | David Smith

The tagline for O'Reilly Strata conference series — Making Data Work — has meant that it's always been popular with practitioners, primarily data scientists working with Big Data in real-world environments. Recent Strata events have also attracted more business-oriented attendees, with events focused more on processes and outcomes than on the implementation ... [Read more...]

Follow the ants to richness

January 29, 2013 | Markus Gesmann

A friend of mine told me the secret of making money at the stock market. "It's easy", he said.All I would have to do is to buy a big jar of ants. Then I should observe the ants movement on my kitchen table, while following the stock market. I ... [Read more...]

Efficiency in Joining Two Data Frames

January 28, 2013 | statcompute

In R, there are multiple ways to merge 2 data frames. However, there could be a huge disparity in terms of efficiency. Therefore, it is worthwhile to test the performance among different methods and choose the correct approach in the real-world work. For smaller data frames with 1,000 rows, all six methods ... [Read more...]

Fun with Twitter

January 28, 2013 | Frank Portman

I’ve been playing around with the ‘twitteR’ package for R ever since I heard of its existence. Twitter is great and easy to mine because the messages are all-text and most people’s profiles are public. This process is made even easier with the ‘twitteR’ package, which takes advantage ... [Read more...]
1 2 3 4 18

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)