> regions = c('cortex', 'hippocampus', 'brain_stem', 'mid_brain', 'cerebellum') > mice = paste('mouse', 1:5, sep='') > for (n in c('Cu', 'Fe', 'Zn', 'Ca', 'Enzyme')) { + assign(n, as.data.frame(replicate(5, rnorm(5)))) + } > names(Cu) = names(Zn) = names(Fe) = names(Ca) = names(Enzyme) = regions > row.names(Cu) = row.names(Zn) = row.names(Fe) = row.names(Ca) = row.names(Enzyme) = mice > Cu cortex hippocampus brain_stem mid_brain cerebellum mouse1 -0.5436573 -0.31486713 0.1039148 -0.3908665 -1.0849112 mouse2 1.4559136 1.75731752 -2.1195118 -0.9894767 0.3609033 mouse3 -0.6735427 -0.04666507 0.9641000 0.4683339 0.7419944 mouse4 0.6926557 -0.47820023 1.3560802 0.9967562 -1.3727874 mouse5 0.2371585 0.20031393 -1.4978517 0.7535148 0.5632443 > Zn cortex hippocampus brain_stem mid_brain cerebellum mouse1 -0.66424043 0.6664478 1.1983546 0.0319403 0.41955740 mouse2 -1.14510448 1.5612235 0.3210821 0.4094753 1.01637466 mouse3 -0.85954416 2.8275458 -0.6922565 -0.8182307 -0.06961242 mouse4 0.03606034 -0.7177256 0.7067217 0.2036655 -0.25542524 mouse5 0.67427572 0.6171704 0.1044267 -1.8636174 -0.07654666 > Fe cortex hippocampus brain_stem mid_brain cerebellum mouse1 1.8337008 2.0884261 0.29730413 -1.6884804 0.8336137 mouse2 -0.2734139 -0.5728439 0.63791556 -0.6232828 -1.1352224 mouse3 -0.4795082 0.1627235 0.21775206 1.0751584 -0.5581422 mouse4 1.7125147 -0.5830600 1.40597896 -0.2815305 0.3776360 mouse5 -0.3469067 -0.4813120 -0.09606797 1.0970077 -1.1234038 > Ca cortex hippocampus brain_stem mid_brain cerebellum mouse1 -0.7663354 0.8595091 1.33803798 -1.17651576 0.8299963 mouse2 -0.7132260 -0.2626811 0.08025079 -2.40924271 0.7883005 mouse3 -0.7988904 -0.1144639 -0.65901136 0.42462227 0.7068755 mouse4 0.3880393 0.5570068 -0.49969135 0.06633009 -1.3497228 mouse5 1.0077684 0.6023264 -0.57387762 0.25919461 -0.9337281 > Enzyme cortex hippocampus brain_stem mid_brain cerebellum mouse1 1.3430936 0.5335819 -0.56992947 1.3565803 -0.8323391 mouse2 1.0520850 -1.0201124 0.89600005 1.4719880 1.0854768 mouse3 -0.2802482 0.6863323 -1.37483570 -0.7790174 0.2446761 mouse4 -0.1916415 -0.4566571 1.93365932 1.3493848 0.2130424 mouse5 -1.0349593 -0.1940268 -0.07216321 -0.2968288 1.7406905
In each anatomic region, I would like to calculate the correlation between Enzyme activity and each of the concentrations of Cu, Zn, Fe, and Ca, and do a scatter plot with a tendency line, organizing those plots into a grid. See the image below for the desired effect: http://postimage.org/image/62brra6jn/ How can I achieve this? Thank you in advance. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.