Question
panel.hist <- function(x, ...) {
usr <- par("usr"); on.exit(par(usr))
par(usr = c(usr[1:2], 0, 1.5) )
h <- hist(x, plot = FALSE)
breaks <- h$breaks; nB <- length(breaks)
y <- h$counts; y <- y/max(y)
rect(breaks[-nB], 0, breaks[-1], y, col = "cyan", ...)
}
For each line of the function, explain what it’s doing.
Solution Preview
These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.
panel.hist <- function(x, ...) {We are creating a function named as “panel.hist” in first line. The above code is used to create histogram on the diagonals in a scatter plot matrix.
usr <- par("usr"); on.exit(par(usr))
The above function calculates the number of pairs of correlation or scatter plots....
By purchasing this solution you'll be able to access the following files:
Solution.docx.