[R] Help deeded: Does a R graphical function return something special?

Deepayan Sarkar deepayan.sarkar at gmail.com
Fri Oct 19 23:12:12 CEST 2007


On 10/19/07, HU,ZHENGJUN <hhu at ufl.edu> 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



More information about the R-help mailing list