Skip to content
Prev 149187 / 398498 Next

Plot depends on conditions

Dear R users,

I want to do some plots which depends on conditions (7 conditions)
I had collected all the conditions in a vector Cond(c1,c2,c3,c4,c5,c6,c7)
All the conditions are logic (TRUE/FALSE).

If c1 or c2 are FALSE I want to have only one Plot. Then I want to have a
break (something like stop() or abort()) -> no need to continue the
execution.
If c3 or c4 are FALSE I want par(mfrow=c(2,1)). Then a break
If c5,c6 or c7 are FALSE par(mfrow=c(2,2)). Then a break

If (all(Cond)) then another plot, par(mfrow=c(2,2))

I think the best way is to build a function which plots depending on the
conditions
Do any one have an idea how to do this properly?

Thanks in advance,
Adel