Articles by nzcoops

Shading between two lines – ggplot

June 1, 2014 | nzcoops

First one to say geom_ribbon loses. I was plotting some data for a colleague, had two lines (repeated experiment) per person (time on the x axis) facetted by id, I thought it’d be nice to shade the area between the … Continue reading → [Read more...]

Finding the midpoint when creating intervals

May 23, 2014 | nzcoops

Nothing ground breaking here. I was doing some work dividing data into deciles and then creating some plots. I couldn’t find an function to calculate this from cut, and I use cut quite a bit. So here we are. midpoints … Continue reading → [Read more...]

ggplot + powerpoint = wall + head … solution?

September 2, 2013 | nzcoops

Confession, by ‘solution?’ I literally mean I’m asking for your thoughts on a solution. Like it or lump it I do a lot of graphs for presentations, largely in powerpoint. That’s the way my colleagues/industry work(s) and it’s not about … Continue reading → [Read more...]

Updated age calculation function

June 12, 2013 | nzcoops

I had previously posted a function for calculating age with two dates. This was for the whole number ‘age’ where we are assuming you don’t want someone to be recorded as ’18′ until their 18th birthday (so more than just … Continue reading → [Read more...]

ggplot graphs in publications?

November 6, 2012 | nzcoops

The grey background and/or default choice of colours for groups makes a ggplot graph stand out to any R user when seen in a presentation. But ggplot graphs get all ninja when it comes to publications, either that or not … Continue reading → [Read more...]

Forest plots in R (ggplot) with side table

November 6, 2012 | nzcoops

A friend asked me to help with a forest plot recently. After chatting about what she wanted the end result to look like, this is what I came up with. grid.arrange(data_table, p, ncol=2) ## Warning: Removed 1 rows containing missing … Continue reading → [Read more...]

Popularity indicator, with images (NFL)

September 23, 2012 | nzcoops

It’s Friday night, there’s nothing good on TV, mmm conditions are perfect for shaggin about in R. So I’m an NFL fan, and (shameless plug) avid fan of this NFL podcast. They run their own pickem league which unless users … Continue reading → [Read more...]

Simple plot with text boxes

September 21, 2012 | nzcoops

Was doing a little presentation to our research group and had to explain the difficulties of ‘collapsing’ longitudinal data into a single measure when the Y var is quite variable. For the particular Y var of interest, it represents burden … Continue reading → [Read more...]

Petrol prices adjusted for inflation

July 28, 2012 | nzcoops

Petrol prices adjusted for inflation (Perth, Western Australia) The thought for this sprung to mind when I saw petrol drop below $1.20 per litre the other day, and it made me think, I remember paying that when I got to … Continue reading → [Read more...]

LME summary data – results table

May 21, 2012 | nzcoops

UPDATE: Based on the comment from ‘linuxizer’, I’ve updated this to stay inline with the S3 classes, something I didn’t have my head around at the time, still don’t know it inside out. Brief post. One thing I do often … Continue reading → [Read more...]

Latent class mixed models – with graphics

October 2, 2011 | nzcoops

Foreword Apologies that the output isn’t showing well as far as spacing and alignment is concerned. Am working on fixing that! Background Generally when we have a set of data, we have known groupings. Be that three different treatment groups, … Continue reading → [Read more...]

Children height and blood pressure z-scores

September 20, 2011 | nzcoops

Following on from some of my earlier posts, this is purely about, hopefully, saving some other people some time in putting this together. Height z-scores are required to then calculate the blood pressure z-scores. The CDC (Center for Disease Control … Continue reading → [Read more...]

2011 Perth City to Surf Stats

September 6, 2011 | nzcoops

Like every year, August sees the thousands taking part in the Perth City to Surf, and with that comes the chance for some stats. Why? Curiosity more than anything, and to convince myself that my time in the 12km run … Continue reading → [Read more...]

ICD code – search looping

July 15, 2011 | nzcoops

Following on from my earlier post on creating a table of ICD codes in R, here is how I am currently counting these codes and storing the codes in a dataframe: Firstly create a dataframe to store the results in: hosp_count [Read more...]

ICD codes – Analysing hospitilisations

July 14, 2011 | nzcoops

A brief first post on what I hope will be a series of posts on analysing hospitilisation data, which is recorded using ICD codes (International Statistical Classification of Diseases and Related Health Problems) Initially here is an R file. This can be read in and will create a list, 218 long, ... [Read more...]

gridExtra – Multiple plots from ggplot2

June 8, 2011 | nzcoops

Thanks to this great post http://www.imachordata.com/?p=730 we can now put multiple plots on a display with ggplot2. This provides somewhat similar functionality to ‘par(mfrow=c(x,y))’ which would allow multiple plots with the base plot function. gridExtra doesn’t have quite the same level ... [Read more...]

Generating unique random IDs

June 7, 2011 | nzcoops

Recently I was asked to help create random IDs for someone. At first I thought, ‘Ah yup, 1:x (1,2,3, …,x), job done’. Then I thought that there had to be a R function/package to create better looking IDs, to which I didn’t find one, if there is, please let ... [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)