[R] Grouping sets of data, performing function and re-assigning values

Johnny Tkach johnny.tkach at utoronto.ca
Fri Aug 27 15:58:56 CEST 2010


Hi there,

I hope you have time to read this question and offer a suggestion or two.

My basic question is this:  

I have data in sets of three.  I would like to combine the data from each set, perform a function (probably just taking the median and MAD), then re-assign these values to each of the original sets of data.

As a bit of background, I have performed a microscopy screen and analyzed the images using software called CellProfiler.  I have three 'control' images that I would like to combine and then compare parameters from each of my 'treatment' images to the combined control data.

However, there are a couple of 'wrinkles' to my problem: Not all the data is actually in sets of three.   If there are no objects in a particular field,CellProfiler does not output anything for that image.  For example, I could have the following data set:

ImageNumber	Measurement
1				5
2				7
3				8
4				3
6				9

So in this example, I would like to combine images 1 to 3 in one set and 4 to 6 in another set (image 5 was empty).

Here is another 'wrinkle':
For each image, there are multiple measurements based on the number of objects in the field of view I have measured.  So my data actually looks something like this

ImageNumber	Measurement
1				4
1				5
1				5
2				6
2				7
2				8
3				8
3				9
4				1
4				1
4				6
4				3
6				10
6				9
6				5
6				8

I have attached a .csv containing a portion of the actual data (in this example, images 1 through 3 are not present).

Right now, I can split the data.frame based on the ImageNumber column and perform functions, but I can't come up with a way of combining the data in a way that might account for the absence of some of the images.

Thanks for reading and any help and suggestions are much appreciated.			

JT


-------------- next part --------------





More information about the R-help mailing list