Blog Archives

LME summary data – results table

May 21, 2012
By
LME summary data – results table

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 »

Kaplan-Meier Survival plot – with at risk table, by sub groups

May 4, 2012
By
Kaplan-Meier Survival plot – with at risk table, by sub groups

This is a follow on from the previous post, with updated code. There was an argument ‘groups’ in the ggplot(…) line of the code that was working but is now no longer working with the updated version of R/ggplot2 (I … Continue reading →

Read more »

Kaplan-Meier Survival Plot – with at risk table

November 5, 2011
By
Kaplan-Meier Survival Plot – with at risk table

Credit for the bulk of this code is to Abhijit Dasgupta and the commenters on the original post here from earlier this year. I have made a few changes to the functionality of this which I think warrant sharing. A brief … Continue reading →

Read more »

Latent class mixed models – with graphics

October 2, 2011
By
Latent class mixed models – with graphics

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
By
Children height and blood pressure z-scores

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
By
2011 Perth City to Surf Stats

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
By
ICD code – search looping

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 <- as.data.frame(matrix(ncol=length(icd_codes))) names(hosp_count) <- names(icd_codes) Counting Occurences: Then start to loop through your dataset with

Read more »

ICD codes – Analysing hospitilisations

July 14, 2011
By
ICD codes – Analysing hospitilisations

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, forming groupings using sub

Read more »

gridExtra – Multiple plots from ggplot2

June 8, 2011
By
gridExtra – Multiple plots from ggplot2

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 of options as ‘par’, but the syntax is simple. grid.arrange( graph1, graph2, ncol=2 Simple. ‘grid.table’

Read more »

Generating unique random IDs

June 7, 2011
By
Generating unique random IDs

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 me know. In the mean time

Read more »