Thanks, Felix!

I do find another function definition in my current R console, do you know
how to cancel it or delete it from the memory?

> head(panel.histogram)

1 function (x, ...)
2 {
3     fc <- hist(x, plot = FALSE, right = F)
4     fcper <- fc$counts/sum(fc$counts)
5     hist(x, data = total, labels = as.character(round(fcper,
6         2)))









On Tue, Apr 27, 2010 at 11:53 PM, Felix Andrews <felix@nfrac.org> wrote:

> >    The following object(s) are masked _by_ .GlobalEnv :
> >
> >     panel.histogram
>
>
> why do you have another definition of "panel.histogram"? you need to
> use the one from the lattice package:
>
> rm(panel.histogram)
>
>
>
> On 24 April 2010 01:48, Changbin Du <changbind@gmail.com> wrote:
> > Dear Dr. Sarkar,
> >
> > When I try to run the codes,  I found the following problem:
> >
> >
> >
> >> h<- sample(1:14, 319, rep=T)
> >> c<- sample(1:14, 608, rep=T)
> >> n<- sample(1:14, 1140, rep=T)
> >> vt<-c(h, c, n)
> >> ta<-rep(c("h", "c", "n"), c(319, 608, 1140))
> >>
> >> to<-data.frame(vt,ta)
> >
> >
> >> library(lattice)
> >
> > Attaching package: 'lattice'
> >
> >
> >    The following object(s) are masked _by_ .GlobalEnv :
> >
> >     panel.histogram
> >
> >>
> >>
> >>
> >> histogram(~ vt|ta, data=to, layout=c(1,3), type = "count",
> > +          panel = function(x, breaks, ...) {
> > +              panel.histogram(x = x, breaks = breaks, ...)
> > +              hh <- hist(x, breaks = breaks, plot = FALSE)
> > +              with(hh, panel.text(x = mids, y = counts,
> > +                                  labels = as.character(counts),
> > +                                  pos = 1))
> > +          },
> > +          labels=TRUE, main="Histograms by target", col="skyblue")
> > Warning messages:
> > 1: In title(main = main, sub = sub, xlab = xlab, ylab = ylab, ...) :
> >  "data" is not a graphical parameter
> > 2: In axis(1, ...) : "data" is not a graphical parameter
> > 3: In axis(2, ...) : "data" is not a graphical parameter
> > 4: In title(main = main, sub = sub, xlab = xlab, ylab = ylab, ...) :
> >  "data" is not a graphical parameter
> > 5: In axis(1, ...) : "data" is not a graphical parameter
> > 6: In axis(2, ...) : "data" is not a graphical parameter
> > 7: In title(main = main, sub = sub, xlab = xlab, ylab = ylab, ...) :
> >  "data" is not a graphical parameter
> > 8: In axis(1, ...) : "data" is not a graphical parameter
> > 9: In axis(2, ...) : "data" is not a graphical parameter
> >> searchpaths()
> >  [1] ".GlobalEnv"                  "/home/cdu/library/lattice"
> >  [3] "/home/cdu/library/stats"     "/home/cdu/library/graphics"
> >  [5] "/home/cdu/library/grDevices" "/home/cdu/library/utils"
> >  [7] "/home/cdu/library/datasets"  "/home/cdu/library/methods"
> >  [9] "Autoloads"
> >
> >
> > Do you have any suggestions for this problem?
> >
> > Thanks so much!
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Fri, Apr 23, 2010 at 5:45 AM, Deepayan Sarkar <
> > deepayan.sarkar@r-project.org> wrote:
> >
> >> On Tue, Apr 20, 2010 at 8:59 AM, Changbin Du <changbind@gmail.com>
> wrote:
> >> > HI, Dear Deepayan,
> >> >
> >> > I am using the following codes to get the conditional histogram, can I
> >> label
> >> > the values on each bar?
> >> > Thanks so much!
> >> >
> >> > h<- sample(1:14, 319, rep=T)
> >> > c<- sample(1:14, 608, rep=T)
> >> > n<- sample(1:14, 1140, rep=T)
> >> > vt<-c(h, c, n)
> >> > ta<-rep(c("h", "c", "n"), c(319, 608, 1140))
> >> >
> >> > to<-data.frame(vt,ta)
> >> >
> >> > library(lattice)
> >> > histogram(~ vt|ta, data=to, layout=c(1,3), labels=TRUE,
> main="Histograms
> >> by
> >> > target", col="skyblue")
> >>
> >> You have to write a custom panel function. Here's one example:
> >>
> >> histogram(~ vt|ta, data=to, layout=c(1,3), type = "count",
> >>          panel = function(x, breaks, ...) {
> >>              panel.histogram(x = x, breaks = breaks, ...)
> >>              hh <- hist(x, breaks = breaks, plot = FALSE)
> >>              with(hh, panel.text(x = mids, y = counts,
> >>                                  labels = as.character(counts),
> >>                                  pos = 1))
> >>          },
> >>           labels=TRUE, main="Histograms by target", col="skyblue")
> >>
> >> The function may need to be more complicated depending on what you need.
> >>
> >> -Deepayan
> >>
> >
> >
> >
> > --
> > Sincerely,
> > Changbin
> > --
> >
> >        [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
>
>
> --
> Felix Andrews / 安福立
> Postdoctoral Fellow
> Integrated Catchment Assessment and Management (iCAM) Centre
> Fenner School of Environment and Society [Bldg 48a]
> The Australian National University
> Canberra ACT 0200 Australia
> M: +61 410 400 963
> T: + 61 2 6125 4670
> E: felix.andrews@anu.edu.au
> CRICOS Provider No. 00120C
> --
> http://www.neurofractal.org/felix/
>



-- 
Sincerely,
Changbin
--

	[[alternative HTML version deleted]]

