Re: [R] lattice densityplot with weights

2023-09-29 Thread Deepayan Sarkar
Yes, the following should (mostly) work: lattice::densityplot(~ x, mydf, groups = name, weights = wt, auto.key = list(space = "inside"), grid = TRUE) I just realised that the 'subdensity' and 'warnWbw' arguments are not passed through by densityplot(), so there is no way to get rid of the cor

Re: [R] lattice densityplot with weights

2023-09-29 Thread Bert Gunter
Unless I misunderstand... See ?panel.densityplot Lattice functions do their work through a host of panel functions, typically passing their ... arguments to the panel functions. panel.densityplot has a weights argument. Cheers, Bert On Fri, Sep 29, 2023 at 3:32 AM Naresh Gurbuxani < naresh_g

[R] lattice densityplot with weights

2023-09-29 Thread Naresh Gurbuxani
density() function in R accepts weights as an input. Using this function, one can calculate density and plot it. Is it possible to combined these two operations in lattice densityplot()? mydf <- data.frame(name = "A", x = seq(-2.9, 2.9, by = 0.2), wt = diff(pnorm(seq(-3, 3, by = 0.2 mydf <