Posts Tagged ‘ programming ’

Some rediscovered R scripts from spring cleaning

May 1, 2011
By
Some rediscovered R scripts from spring cleaning

Gompertz Model Visualization # Gomperz growth function gomp <- function(x, a, b, k) a*exp(-b*exp(-k*x))   # Normal model with Gompertz mean function likelihood <- function(weight, age, sigma, a, b, k) { mu <- gomp(age, a, b, k) dnorm(weight, mu, sigma) }   # Visualize the model visualize <- function(phi=40, theta=-35) { weight <- seq(0, 250,

Read more »

Data Aggregation in R: plyr, sqldf and data.table

April 28, 2011
By
Data Aggregation in R: plyr, sqldf and data.table

I’ve also previously put up a couple of posts about aggregating data in R. In this post, I’m going to be trying some other alternative methods for aggregating the dataset. Before I begin, I’d like to thank Matthew Dowle for highlighting these to me. It’s a bit daunting at first, deciding which method of aggregating data is

Read more »

Further Adventures in Visualisation with ggplot2

April 25, 2011
By
Further Adventures in Visualisation with ggplot2

So I previously took a look at some data of player performance from a computer game. In this post, I’m going to do some further visualisations using ggplot2. The data consists of different types of player character, different roles for those characters, and their overall damage output (the unit here is damage per second, or

Read more »

Sexy, Geeky Graphs using ggplot2 in R

April 22, 2011
By
Sexy, Geeky Graphs using ggplot2 in R

So I’ve been looking for some data to play with while learning R, other than the data I’m analysing for various experiments and papers I’m working on. I thought to myself, “Hey, this R stuff is pretty geeky. Can I engage in a higher level of geekiness?” And I think I’ve found a way: using

Read more »

Aggregate Function in R: Making your life easier, one mean at a time

April 20, 2011
By
Aggregate Function in R: Making your life easier, one mean at a time

I previously posted about calculating medians using R. I used tapply to do it, but I’ve since found something that feels easier to use (at least to me). ?Download download.txt1 2 3 aggregated_output = aggregate(DV ~ IV1 * IV2, data=data_to_aggregate, FUN=median) aggregated_output The above code saves an aggregated dataset to aggregated_output and gives you the

Read more »

RStudio, Revolution Analytics and Deducer: A Tale of Three GUIs

April 19, 2011
By

I’m in the process of moving from SPSS to R at the moment. It’s not been the easiest of rides, but then learning how to do a core part of your job never really should be. It’s been fun, though – don’t get me wrong – it’s definitely been an adventure!! Here I’m going to

Read more »

Progress reading SAS sas7bdat files (natively) in R

April 18, 2011
By

This post describes some preliminary results from a compatibility study of the SAS sas7bdat file format. The most current results stored in a github repository here: sas7bdat The ultimate goal is a native solution to the incompatibility between open-source statistical software (e.g. R) and sas7bdat database files. Demonstration There has been significant progress in interpreting

Read more »

Pivot Tables and Medians in R

April 16, 2011
By

Pivot Tables are a useful way of aggregating data into the format that you’re after. In this example, I’m going to be using R to pivot some data and calculate medians for me. This is useful because Excel can calculate medians (the =MEDIAN(values)) function, but what it can’t do is calculate medians for Pivot Tables.

Read more »

RStudio 0.93 Beta Available

April 15, 2011
By
RStudio  0.93 Beta Available

In case you miseed, 0.93 Beta of RStudio is released! A good set of fixes, including vignette() (sorry edit() not compatible yet). The panel layout is fully customizable, and there are a load of bug fixes.See the Release Notes for more info.

Read more »

Problems with ggplot2 0.8.9 and R 2.13.0 on Mac OS X via plyr 1.5

April 14, 2011
By

This morning I tried to completely update my R installation. I first dumped a list of all the packages I have on my system using the installed.packages() function. Then I installed R 2.13.0 using the OS X disk image. And finally I reinstalled all of my packages from scratch. Unfortunately, I ran into some serious

Read more »