[Rd] Call trellis function in a function (PR#8827)

Roger Bivand Roger.Bivand at nhh.no
Tue May 2 16:13:10 CEST 2006


On Tue, 2 May 2006 xiao.gang.fan1 at libertysurf.fr wrote:

This is a FAQ:

http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f

> Full_Name: Fan
> Version: 2.2.1
> OS: Windows
> Submission from: (NULL) (159.50.101.9)
> 
> 
> Hello,
> 
> When I call trellis function (such as histogram, densityplot, etc.) in a
> function,
> the call seems being ignored (no graphics is drawing) if some other instructions
> 
> are placed afeter that call. 
> 
> Here's an example:
> 
> y = rnorm(100*3)
> b = sample(1:3,300,replace=T)
> 
> f = function()
> {
>   densityplot(~y|b)
> }
> 
> f1 = function()
> {
>   densityplot(~y|b)
>   return(1)
> }
> 
> f1()  # this will not draw the histogram
> f()   # this will draw the histogram
> 
> Thanks in advance
> Kind regards
> --
> Fan
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-devel mailing list