I am trying plot the subsets of a table using ggplot and gridExtra. But I have bumbed in the following error EXPR must be a length 1 vector.
I could come up with any si
Change
mplot <- mapply(p,dt2[,zone1],dt2[,zone2])
to
mplot <- mapply(p,dt2[,zone1],dt2[,zone2], SIMPLIFY=FALSE)
or
mplot <- Map(p,dt2[,zone1],dt2[,zone2])
mapply()
will attempt to coerce it's result to a matrix if the dimensions of the returned objects match up, however, in this case you will always want a list. You can either set the SIMPLIFY=
parameter to false, or use Map()
which always returns a list.