I have a list of dataframes (dflist) and data I want to compare each data frame against (actual)
A sample of what the data looks like:
dflist[['2Source'}}
Chem 1 Chem 2
.01 .02
.02 .03
.01 .03
actual
Chem 1 Chem 2
.01 .02
.03 .02
.01 .04
I want to plot each column against the identical column in the other table so, dflist[['2Source']][Chem 1] vs actual[Chem 1] and for chem 2. My actual data has 18 chemicals so I'm trying to write something with lapply to look all of them.
par(mfrow=c(3,4))
Chemnames <- names(dflist[['2Source']])
baseplot <- function(x,y, name) {
plot(x, y, main = name)
abline(lm(y~x))}
lapply(seq_along(dflist), function(i)
mapply(function(x,y, name) {
plot(x, y, main = names(Chemnames(name)))
abline(lm(y~x))}, x = actual, y = dflist[[i]]))
This is my current code which seems to work minus the labels and I can't figure it out.
