Reputation: 1917
I am reading R code for k-mean clustering. The first 3 lines of code are:
def.par <- par(no.readonly = T)
par(mfrow = c(1,3))
par(oma = c( 5, 0, 3, 0))
I read the help manual, but I am still confused. I assumed that it is important for graphics.
Upvotes: 0
Views: 4495
Reputation: 7894
par
sets the global state for any graphical related commands.
This frees commands like ggplot
, plot
, etc from having to store this info on their own.
it also allows the user to swap out graphing methods, ie move from plot to ggplot2
when they need more power without having to reenter this information again.
In the specific instance you use, mfrow
tells the app to layout 1 row with 3 columns
oma
is used to set an outer margin on the drawing surface.
As always, help(....) and ?.... as well as experimentation are your friend when you encounter an R command you don't understand!
Upvotes: 1