[R] Help Required in looping visuals
Ismail SEZEN
sezenismail at gmail.com
Mon Aug 21 14:48:34 CEST 2017
> On 21 Aug 2017, at 09:30, Venkateswara Reddy Marella (Infosys Ltd) via R-help <r-help at r-project.org> wrote:
>
> Hi Team ,
>
> I have a requirement of building set of panels in which each panel has multiple visuals based on single set of dataset values and this thing is repeated for other set of values as well.
> For this requirement , I am trying to use a for loop to create visuals and panel for each set of values ( like first panel should be for first set of dataset values and so on) . Do we have any available solution for this problem.
>
> Thanks,
> Venkat.
I suspect you want to plot categorical variables in panels. Run the code below and see if it solves your problem. If not, create a minimal example as below and ask your question again.
df <- data.frame(set = factor(paste0("set", rep(1:6, each = 20))),
x = rnorm(120), y = rnorm(120))
library(lattice)
xyplot(x~y|set, df, type = "p", as.table = TRUE)
library(ggplot2)
ggplot(df, aes(x = x, y = y, color = set)) +
facet_wrap(~set, nrow = 2, ncol = 3) +
geom_point()
More information about the R-help
mailing list