I have four list of plots (each list has 8 plots), where these lists have been compiled as a list. So, basically; list of 4 lists, where each sub-list has 8 plots.
Now, I need 8 lists as outcome; wherein first element of each of 4 lists generated as a separate list.
Can anyone help over here that how can I use either "lapply" or "for loop" to get required outcome?
I tried following block, but there was no output [ABC -> "NULL"].
PlotsA <- list(Plot1.png, Plot2.png,..., Plot8.png)
PlotsB <- list(Plot9.png, Plot10.png,..., Plot16.png)
PlotsC <- list(Plot17.png, Plot18.png,..., Plot24.png)
PlotsD <- list(Plot25.png, Plot26.png,..., Plot32.png)
All_Plots <- list(PlotsA, PlotsB, PlotsC, PlotsD)
ABC <- for (i in seq_along(All_Plots)){
for (j in length(All_Plots[[i]])){
x = list(All_Plots[[i]][j])
x
}
}
ABC
The outcome I am looking for is...
Outcome1
[1]
Plot1.png, Plot9.png, Plot17.png, Plot25.png
Outcome2
[2]
Plot2.png, Plot10.png, Plot18.png, Plot26.png
...
and so on.
Further processing include grid of 4 plots (for eg., Plot1.png, Plot9.png, Plot17.png, and Plot25.png). I can do this once I get the aforementioned outcomes.