[R] A simple lattice histogram

Naresh Gurbuxani n@re@h_gurbux@n| @end|ng |rom hotm@||@com
Wed Apr 20 17:27:54 CEST 2022


I am struggling with a simple histogram where scales of x-axis should be free.  Each panel should only show the range relevant for data plotted in that panel.  

library(lattice)
library(AER)
data(CreditCard)
histogram( ~ card + reports, data = CreditCard, scales = "free")

This code creates two panels of histograms.  But each panel has x-axis range from 0 to 14 and "yes" and "no".  I want a graph where "card" panel x-axis only has "yes" and "no" and where "reports" panel only has numbers 0 to 14.  

How can this code be fixed?

Thanks,
Naresh


More information about the R-help mailing list