Re: [R] creating functions in R

From: Roger Bivand <Roger.Bivand_at_nhh.no>
Date: Fri 18 Mar 2005 - 22:41:13 EST


On Fri, 18 Mar 2005, Uwe Ligges wrote:

> Oarabile Ruth Molaodi wrote:
>
> > I am trying to learn how to create my own function in R. I want to
> > create a function that can plot the polygons/regions/map given the
> > coordinates of each region. The function should be able to colour the
> > poplygons according to the data supplied ,for examples the means or
> > rates of disease at a region/polygon.
>
>
> You might want to take a look at package "maps".

Or others mentioned on http://www.R-project.org/Rgeo, for example, see how the DCluster package plots disease rates, or look at plot.polylist() in the maptools package. The maps package does depend on the user building a geographical database first, rather than taking an arbitrary ring of coordinates as a polygon. Colouring is a class interval problem, which has to be done separately anyway - see the examples on the help pages for the relevant functions (hint - findInterval() is good at setting the colour vector for the polygons).

Roger Bivand

>
> Uwe Ligges
>
>
> > your advise will be highly appreciated.
> >
> > Thanks in advance for your help.
> >
> > Oarabile
> >
> > ______________________________________________
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> > http://www.R-project.org/posting-guide.html
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Fri Mar 18 22:47:08 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:51 EST