I split a data frame based on 'index' to plot each Group side by side for comparison as:
Grp <- split(TOC, TOC$Index)
$`1`
Site Index depth_ft TOC_mg.g IC_mg.g
1 Z 1 5 12 NA
$`1`
Site Index depth_ft TOC_mg.g IC_mg.g
1 A 2 2 11 NA
...
...
I can plot the data easily if I go one by one, say
plot(Grp$`1`$TOC_mg.g, Grp$`1`$depth_ft)
But when I want to plot all groups at once using 'lapply', I just see the X-Y axis without any data points in there (https://docs.google.com/file/d/0B6GUNg-8d30vdmZBMVhKVlR0TkE/edit?usp=sharing)!! Can anyone tell me what is going wrong??
#plot
par(mfrow=c(1,5))
lapply(1:length(Grp), function(i)
plot(Grp$`i`$TOC_mg.g, Grp$`i`$depth_ft, ylim=c(0, max(TOC$depth_ft)),
xlim= c(min(TOC$TOC_mg.g, na.rm=T), max(TOC$TOC_mg.g, na.rm=T)), lwd=2, col=2 ))