[R] simplifying output of mapply

jeremy adler jeremyeadler at gmail.com
Wed Feb 8 22:28:57 CET 2017


Hi

I'm trying to use mapply to generate graphs but I cant figure out how to
get the program to only save the graph to the array and not the other
output.

plt<-function (x,y) {
  p<-dfs[dfs$region==x,c("region",y)]
  colnames(p)<-c("v1","v2")

g<-ggplot(p,aes(v2))+geom_density(aes(x=v2,fill=v1))+geom_histogram(aes(y=..density..),alpha=.5)+
theme(legend.position="none")
  g<-g+xlab(x)
  return(g)

}
m<-mapply(FUN=plt,x=c("spot_001"),y=c("Cell.Median.CD3"))

So I just want the graphs (g) to be stored in m and none of the other
extraneous output. Thanks for your help!

Jeremy

	[[alternative HTML version deleted]]



More information about the R-help mailing list