[BioC] Grid layout to data.frame with row & colums

James MacDonald jmacdon at med.umich.edu
Wed Nov 25 12:57:12 CET 2009

Hi Daniel,

What you show below is by row (in the original data.frame). If the order of the resulting vector of C and N can be by column-major order, then this will work:

a <- data.frame(matrix(sample(c("C","N"), 100, TRUE), ncol = 10))
b <- data.frame(expand.grid(seq_len(dim(a)[1]), seq_len(dim(a)[2])), unlist(a))



>>> Daniel Brewer <daniel.brewer at icr.ac.uk> 11/25/09 6:16 AM >>>

I have some tissue microarray(TMA) structure files that show the grid 
layout of the probes/cores on the TMA e.g.

	1	2	3	4
1		C	C	N
2	N	C	C
3	C	C	C

I would like to convert this into a data.frame with each row being a 
different core i.e.

Row	Column	Status
1	2	C
1	3	C
1	4	N
2	1	N
2	2	C
2	3	C
3	1	C
3	2	C
3	3	C

Does anyone know of an elegant way of doing this?




Daniel Brewer, Ph.D.

Institute of Cancer Research
Molecular Carcinogenesis
15 Cotswold Road
Sutton, Surrey SM2 5NG
United Kingdom

Tel: +44 (0) 20 8722 4109


The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company Limited by Guarantee, Registered in England under Company No. 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP.

This e-mail message is confidential and for use by the a...{{dropped:13}}

More information about the Bioconductor mailing list