[R] [External] A simple lattice histogram

Naresh Gurbuxani n@re@h_gurbux@n| @end|ng |rom hotm@||@com
Wed Apr 20 23:01:47 CEST 2022


Richard,

Thanks for your quick response.  Since I also want the name of the variable in the histogram, I settled for below code.  Not an elegant solution, but displays what I want.  

reports.hist <- histogram(~ reports, data = CreditCard)
income.hist <- histogram(~ income, data = CreditCard)
share.hist <- histogram(~ share, data = CreditCard)
dependents.hist <- histogram(~ dependents, data = CreditCard)
plot(reports.hist, c(0, 0.5, 0.5, 1), more = TRUE)
plot(income.hist, c(0.5, 0.5, 1, 1), more = TRUE)
plot(share.hist, c(0, 0, 0.5, 0.5), more = TRUE)
plot(dependents.hist, c(0.5, 0, 1, 0.5), more = FALSE)

Naresh

From: Richard M. Heiberger <rmh using temple.edu>
Sent: Wednesday, April 20, 2022 12:02 PM
To: Naresh Gurbuxani <naresh_gurbuxani using hotmail.com>
Cc: r-help using r-project.org <r-help using R-project.org>
Subject: Re: [External] [R] A simple lattice histogram 
 
start here

 library(latticeExtra)
 c(histogram(~ card, data=CreditCard), histogram(~ reports, data=CreditCard))

then continue with

 resizePanels(c(histogram(~ card, data=CreditCard), histogram(~ reports, data=CreditCard), y.same=TRUE), w=c(2,16))

> On Apr 20, 2022, at 11:27, Naresh Gurbuxani <naresh_gurbuxani using hotmail.com> wrote:
> 
> library(lattice)
> library(AER)
> data(CreditCard)
> histogram( ~ card + reports, data = CreditCard, scales = "free")



More information about the R-help mailing list