Grid layout to data.frame with row & colums
1
0
Entering edit mode
Daniel Brewer ★ 1.9k
@daniel-brewer-1791
Last seen 9.7 years ago
Hello, 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? Thanks Dan -- ************************************************************** Daniel Brewer, Ph.D. Institute of Cancer Research Molecular Carcinogenesis MUCRC 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:2}}
Cancer convert Cancer convert • 627 views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 4 hours ago
United States
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)) Best, Jim >>> Daniel Brewer <daniel.brewer at="" icr.ac.uk=""> 11/25/09 6:16 AM >>> Hello, 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? Thanks Dan -- ************************************************************** Daniel Brewer, Ph.D. Institute of Cancer Research Molecular Carcinogenesis MUCRC 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}}
ADD COMMENT

Login before adding your answer.

Traffic: 605 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6