I was able to make a nice looking histogram by accidentally using a function "histogram" (eg, histogram(myvector)) in R. I closed out of R, opened the same script 5 minutes later on the same computer, and now R is telling me no function found. The function hist(), which I usually use, gives a slightly different looking histogram in terms of placement of axis labels and using frequency rather than percent on the y axis.
Just curious!
The hist
function is part of base R:
R> hist
function (x, ...)
UseMethod("hist")
<bytecode: 0x28fd968>
<environment: namespace:graphics>
The histogram function is (more than likely) part of the lattice package
R> library(lattice)
R> histogram
function (x, data, ...)
UseMethod("histogram")
<environment: namespace:lattice>
Did you load lattice package? If not, what packages did you load? Look at your .Rhistory
file if you can't remember. Alternatively, you can search all possible packages using ??histogram
The mystery histogram
function was probably in package lattice
(though there are literally hundreds out there). Did you do library("lattice")
in your earlier session?
If you type
??histogram
at the R prompt it gives you a list of all the packages with a function named histogram. The one you were using was probably from lattice.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.