Articles by Chris

Structuring R projects

August 9, 2018 | Chris

Structuring R projects is a necessary evil: nobody likes doing it, but everybody enjoys a well-structured, efficient project. This post takes you through some of the key principles of structuring a project well. The post Structuring R projects appeared first on Doodling in Data. [Read more...]

Assignment in R: slings and arrows

July 30, 2018 | Chris

Having recently shared my post about defensive programming in R on the r/rstats subreddit, I was blown away by the sheer number of comments as much as I was blown away by the insight many displayed. One particular comment by u/guepier struck my attention. In my previous post, ...
[Read more...]

The Ten Rules of Defensive Programming in R

July 27, 2018 | Chris

When you think of R, defensive coding may not be your first thought. But writing code that fails well & is easy to debug is more important than you'd think. The post The Ten Rules of Defensive Programming in R appeared first on Doodling in Data.
[Read more...]

Automagic epi curve plotting: part I

May 22, 2018 | Chris

Have you ever wanted to schedule tasks from R and run routine analytics repeatedly at regular intervals? Here's the best way to do it. The post Automagic epi curve plotting: part I appeared first on Doodling in Data.
[Read more...]

SafeGram: visualising drug safety

February 27, 2018 | Chris

Update: an RMarkdown notebook explaining the whole process is available here. Visualising vaccine safety is hard. Doing so from passive (or, as we say it in Britain, ‘spontaneous’!) pharmacovigilance (PhV) sources is even harder. Unlike in active or trial pharmacovigilance, where you are essentially dividing the number of incidents by ...
[Read more...]

T-tests

August 17, 2015 | Chris

One-Sample T-Tests To conduct a one-sample t-test in R, we use the syntax t.test(y, mu = 0) where x is the name of our variable of interest and mu is set equal to the mean specified by the null hypothesis. So, for example, if we wanted to test whether the ... [Read more...]

Determine your Fitbit stride length using a GPS watch

July 15, 2014 | Chris

I have been carrying my Fitbit One for a little over two years with me and it keeps tracking my daily steps. It also tracks my distance covered by multiplying those steps using the stride length which you can either provide explicitly or implicitly setting your heights. In the winter ...
[Read more...]

Analyzing Sleep with Sleep Cycle App and R

January 28, 2014 | Chris

I have been tracking my sleep for almost two years now using my Fitbit. I started with the Fitbit Ultra and then moved on the the Fitbit One after it came out. In October 2013 I found out about the Sleep Cycle (Link) app for the iPhone. For weeks, Sleep Cycle ...
[Read more...]

Berlin Marathon 2014 Participants

November 12, 2013 | Chris

After the 2013 Berlin Marathon sold out in less than four hours, the organizers decided to alter the registration process for 2014. First there was a pre-registration phase followed by a random selection from the pool of registrants to receive a spot. Those who were selected had to register until November 11th, 2013. ...
[Read more...]

Five years of Weight Tracking

June 22, 2013 | Chris

After I moved back from New Jersey in June 2008 I started to track my body weight more seriously. My routine usually consists of getting up and after finishing the morning bathroom I would step on my scale. That way I try to ensure that the condition for each weighing are ...
[Read more...]

Using R for Introductory Statistics, 3.1

May 21, 2010 | Chris

Pairs of categorical data The grades data.frame holds two columns of letter grades, giving pairs of categorical data, like so: prev grade 1 B+ B+ 2 A- A- 3 B+ A- ... 122 B B This type of data can be summarized by the tab...
[Read more...]

The R type system

February 21, 2010 | Chris

R is a weird beast. Through it's ancestor the S language, it claims a proud heritage reaching back to Bell Labs in the 1970's when S was created as an interactive wrapper around a set of statistical and numerical subroutines. As a programming language,...
[Read more...]

Pivot tables in R

January 9, 2010 | Chris

A common data-munging operation is to compute cross tabulations of measurements by categories. SQL Server and Excel have a nice feature called pivot tables for this purpose. Here we'll figure out how to do pivot operations in R.Let's imagine an experim...
[Read more...]

SQL group by in R

December 27, 2009 | Chris

The R statistical computing environment is awesome, but weird. How to do database operations in R is a common source of questions. The other day I was looking for an equivalent to SQL group by for R data frames. You need this to compute summary statist...
[Read more...]

Joining data frames in R

December 17, 2009 | Chris

Want to join two R data frames on a common key? Here's one way do a SQL database style join operation in R.We start with a data frame describing probes on a microarray. The key is the probe_id and the rest of the information describes the location on ...
[Read more...]

Using R and Bioconductor for sequence analysis

August 26, 2009 | Chris

Here's another quick R vignette, in case I pick this up later and need to remind myself where I got stuck. I was trying to use R for a bit of basic sequence analysis, with mixed results.First, install the BSgenome package, which is part of Bioconductor...
[Read more...]

Select operations on R data frames

July 26, 2009 | Chris

The R language is weird - particularly for those coming from a typical programmer's background, which likely includes OO languages in the curly-brace family and relational databases using SQL. A key data structure in R, the data.frame, is used somethin...
[Read more...]
1 2

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)