How to use grid to make layout in R

r
layout

#1

I am studying about girding of plot function to make a good layout in R while studying it I am not able to fully understand to make layout using girding.
for example
str(movies)
‘data.frame’: 570 obs. of 6 variables:
title : chr "The Wizard of Oz" "Singin' in the Rain" "Seven Samurai" "The Bridge on the River Kwai" ... year : int 1939 1952 1954 1957 1959 1959 1959 1962 1964 1964 …
rating : num 8.1 8.4 8.8 8.3 8.2 8.5 8.4 8.4 8.6 7.8 ... votes : int 208759 108083 172933 110134 115368 165993 130010 140500 263464 110105 …
runtime: int 102 103 207 161 212 136 120 216 95 110 ... genre : Factor w/ 4 levels “Action”,“Adventure”,…: 2 4 1 2 2 1 4 2 4 1 …
In this question, I am trying to layout with three figures. The first figure appears top left, the second one bottom left. The third figure should appear on the right and span the entire height of the layout.

my three plot are
plot(movies$rating,movies$runtime)
plot(movies$votes,movies$runtime)
boxplot(movies$runtime)


#2

@sid100158-as you have mention grid specification you can create the matrix in which first plot is the left one and second plot lower left and third will cover whole second column.

grid<-matrix(c(1,2,3,3),nrow=2,ncol=2)
grid
[,1] [,2]
[1,] 1 3
[2,] 2 3
1 signifies the first plot and respectively other number and 1 st column specifies the left and 2nd column right.
and at last give grid to layout function.

Hope this helps!
Regards,
hinduja1234