[R] problem with function "polygon"

Duncan Murdoch murdoch.duncan at gmail.com
Fri Nov 7 16:35:28 CET 2014

On 07/11/2014 10:05 AM, Eric Elguero wrote:
> Hi all,
> I'm trying to use the polygon function from
> the graphics package, and get this error
> message :
>   > polygon(x=c(1,2,3,1),y=c(1,4,5,1))
> Error in .Internal(polygon(xy$x, xy$y, col, border, lty, ...)) :
>     there is no .Internal function 'polygon'
> That annoys me because polygon is actually
> called by several other functions I need.
> my R version:
> R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet"
> Copyright (C) 2014 The R Foundation for Statistical Computing
> Platform: x86_64-pc-linux-gnu (64-bit)
> and I just updated everything.

You are not using the polygon() function from the graphics package, 
you're using one coming from somewhere else (maybe an old version of R, 
or some package).  The polygon() function in the graphics package 
doesn't call .Internal(polygon(..., it calls

.External.graphics(C_polygon, ...

This is one reason why it's a really bad idea to say "yes" when asked 
whether you want to save your R workspace.  If at some point you made a 
copy of the polygon() function and saved it, you're stuck with that one 
forever (or at least until you delete it from your workspace, or even 
better, delete the whole saved workspace).

Duncan Murdoch

More information about the R-help mailing list