R, mapply , ggplot : EXPR must be a length 1 vector

拟墨画扇 提交于 2019-12-02 09:03:06

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!