multi.hist {psych}R Documentation

Multiple histograms on one screen

Description

Given a matrix or data.frame, produce histograms for each variable in a "matrix" form.

Usage

multi.hist(x)

Arguments

x matrix or data.frame

Author(s)

William Revelle
Northwestern University
Evanston, Illinois
revelle@northwestern.edu
http://personality-project.org/revelle.html

Examples

##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--    or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function(x) {nvar <- dim(x)[2]  #number of variables
     nsize=trunc(sqrt(nvar))+1   #size of graphic
     old.par <- par(no.readonly = TRUE) # all par settings which can be changed
     par(mfrow=c(nsize,nsize))       #set new graphic parameters
     for (i in 1:nvar) {
     name=names(x)[i]                #get the names for the variables
     hist(x[,i],main=name,xlab=name) }  #draw the histograms for each variable
     on.exit(par(old.par))   #set the graphic parameters back to the original
     }

[Package psych version 1.0-18 Index]