On 10/19/07, HU,ZHENGJUN <[EMAIL PROTECTED]> wrote: > Hi All, > > When I tried to catch a returned value from a R graphical > function or command (e.g., plot, lines, points, abline, title, > xyplot, etc.), I always get a NULL value if it is executed > correctly. For example: > x <- c(1,2,3,4,5,9,13,19,36) > plot.Comm <- plot(x) # plot.Comm <- try(eval(plot(x))) > > then plot.Comm has a NULL value. Obviously, this is not a good way > to check if or not it is a graphical function or command since > plot.Comm <- NULL also lets plot.Comm be NULL. > > Does anyone knows: > > (1) that a R graphical function or command (e.g., plot, lines, > points, abline, title, xyplot, etc.) could return something > special if it is run correctly, which is different from those > returned from executing any R non-graphical functions or > commands? > > (2) that there is an easy way for a R programmer to know that a R > function or command is a graphical one before executing it?
You should always consult the appropriate help page. ?lines mentions no return value (and returns NULL), but ?hist and ?xyplot do describe non-trivial return values. -Deepayan ______________________________________________ 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.