R users, In S, there was a function called usa() that would draw the map of the United States, plus it had other options for graphics. I have looked but I can't find the equivalent in R. Is there one? Thanks, Jason
On Monday 03 November 2003 15:46, Owen, Jason wrote:> R users, > > In S, there was a function called usa() that > would draw the map of the United States, plus > it had other options for graphics. I have looked > but I can't find the equivalent in R. Is there one? >DescriptionI don't know the usa() function in S but usa() in R gives a map of the US that's the output of a "usa " search, perhaps that is what you are looking for: cheers Martin P.S.: www.freegis.org -> GeoData is worth a look for more maps usa() {map} This database produces a map of the United States mainland generated from US Department of the Census data (see the reference). Usage data(usaMapEnv) Format The data file is merely an assignment to a character string which specifies the name of an environment variable which contains the base location of the binary files used by the map drawing functions. This environment variable (R_MAP_DATA_DIR for the datasets in the maps package) is set at package load time if it does not already exist. Hence setting the environment variable before loading the package can override the default location of the binary datasets. References Richard A. Becker, and Allan R. Wilks, "Maps in S", AT&T Bell Laboratories Statistics Research Report [93.2], 1993. Richard A. Becker, and Allan R. Wilks, "Constructing a Geographical Database", AT&T Bell Laboratories Statistics Research Report [95.2], 1995. US Department of Commerce, Census Bureau, County Boundary File, computer tape, available from Customer Services, Bureau of the Census, Washingdon DC 20233.
On 3 Nov 2003 at 9:46, Owen, Jason wrote: library(maps) # since two days available precompiled for windows map('usa') Kjetil Halvorsen> R users, > > In S, there was a function called usa() that > would draw the map of the United States, plus > it had other options for graphics. I have looked > but I can't find the equivalent in R. Is there one? > > Thanks, > > Jason > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
On 3 Nov 2003 at 16:33, Martin Wegmann wrote:> On Monday 03 November 2003 15:46, Owen, Jason wrote: > > R users, > > > > In S, there was a function called usa() that > > would draw the map of the United States, plus > > it had other options for graphics. I have looked > > but I can't find the equivalent in R. Is there one? > >Description > > I don't know the usa() function in S but usa() in R gives a map of the USWhere did you find that function? In rw1080 on windows XP I get:> usa()Error: couldn't find function "usa">(and help.search("usa") does'nt give anything usefull) Kjetil Halvorsen> > that's the output of a "usa " search, perhaps that is what you are looking > for: > > cheers Martin > > P.S.: www.freegis.org -> GeoData is worth a look for more maps > > usa() {map} > > This database produces a map of the United States mainland generated from US > Department of the Census data (see the reference). > > > Usage > > data(usaMapEnv) > > Format > > > The data file is merely an assignment to a character string which specifies > the name of an environment variable which contains the base location of the > binary files used by the map drawing functions. This environment variable > (R_MAP_DATA_DIR for the datasets in the maps package) is set at package load > time if it does not already exist. Hence setting the environment variable > before loading the package can override the default location of the binary > datasets. > > > References > > > Richard A. Becker, and Allan R. Wilks, "Maps in S", AT&T Bell Laboratories > Statistics Research Report [93.2], 1993. > > > Richard A. Becker, and Allan R. Wilks, "Constructing a Geographical Database", > AT&T Bell Laboratories Statistics Research Report [95.2], 1995. > > > US Department of Commerce, Census Bureau, County Boundary File, computer tape, > available from Customer Services, Bureau of the Census, Washingdon DC 20233. > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> > I don't know the usa() function in S but usa() in R gives a map of the US > > Where did you find that function? In rw1080 on windows XP I get: >Some earlier versions of the maps package (which was then available for "Unix" only), did have individual functions for each country in the world database. In the current version, you need to type: library(maps) map("usa") #or: map("world2", "USA") Ray Brownrigg
I believe in R you need library(maps) before using usa(). Of course, the library has to be installed first. Cheers, Andy __________________________________ Andy Jaworski Engineering Systems Technology Center 3M Center, 518-1-01 St. Paul, MN 55144-1000 ----- E-mail: apjaworski at mmm.com Tel: (651) 733-6092 Fax: (651) 736-3122 |---------+--------------------------------> | | kjetil at entelnet.bo | | | Sent by: | | | r-help-bounces at stat.m| | | ath.ethz.ch | | | | | | | | | 11/03/2003 13:56 | | | | |---------+--------------------------------> >-----------------------------------------------------------------------------------------------------------------------------| | | | To: "R-list" <r-help at stat.math.ethz.ch> | | Martin Wegmann <mailinglist2_wegmann at web.de> | | cc: "Owen, Jason" <wowen at richmond.edu> | | Subject: Re: [R] USA map | >-----------------------------------------------------------------------------------------------------------------------------| On 3 Nov 2003 at 16:33, Martin Wegmann wrote:> On Monday 03 November 2003 15:46, Owen, Jason wrote: > > R users, > > > > In S, there was a function called usa() that > > would draw the map of the United States, plus > > it had other options for graphics. I have looked > > but I can't find the equivalent in R. Is there one? > >Description > > I don't know the usa() function in S but usa() in R gives a map of the USWhere did you find that function? In rw1080 on windows XP I get:> usa()Error: couldn't find function "usa">(and help.search("usa") does'nt give anything usefull) Kjetil Halvorsen> > that's the output of a "usa " search, perhaps that is what you arelooking> for: > > cheers Martin > > P.S.: www.freegis.org -> GeoData is worth a look for more maps > > usa() {map} > > This database produces a map of the United States mainland generatedfrom US> Department of the Census data (see the reference). > > > Usage > > data(usaMapEnv) > > Format > > > The data file is merely an assignment to a character string whichspecifies> the name of an environment variable which contains the base location ofthe> binary files used by the map drawing functions. This environment variable> (R_MAP_DATA_DIR for the datasets in the maps package) is set at packageload> time if it does not already exist. Hence setting the environment variable> before loading the package can override the default location of thebinary> datasets. > > > References > > > Richard A. Becker, and Allan R. Wilks, "Maps in S", AT&T BellLaboratories> Statistics Research Report [93.2], 1993. > > > Richard A. Becker, and Allan R. Wilks, "Constructing a GeographicalDatabase",> AT&T Bell Laboratories Statistics Research Report [95.2], 1995. > > > US Department of Commerce, Census Bureau, County Boundary File, computertape,> available from Customer Services, Bureau of the Census, Washingdon DC20233.> > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:> > On Tue, 4 Nov 2003 kjetil at entelnet.bo wrote: > > > On 3 Nov 2003 at 15:04, apjaworski at mmm.com wrote: > > > > > > > > I believe in R you need > > > > > > library(maps) > > > > > > before using usa(). Of course, the library has to be installed first. > > > > > > > Yes, I new that. When I did help.search("usa") I HAD maps > > attached. It dosen't have any function usa(). R is more international > > minded: > > > > > library(maps) > > > usa() > > Error: couldn't find function "usa" > > > map('usa') > > > > > map('china') > > map('bolivia') > > > > and so on also works! > > You need library(mapdata) for those. >Except the Bolivia map must be a local one (from kjetil at entelnet.bo?); it is not in library(mapdata). Ray Brownrigg
On 5 Nov 2003 at 8:21, Ray Brownrigg wrote:> Except the Bolivia map must be a local one (from kjetil at entelnet.bo?); > it is not in library(mapdata). > > Ray BrownriggSorry, I should have typed> library(maps) > library(mapdata) > map("worldHires","bolivia")which indeed shows a correctly-looking map. I also tried> map("worldHires","sweden") > map("worldHires","denmark") # which comes out very small since it# includes the Faroe # islands properly far- # away> map("worldHires","andorra") > map("worldHires","norway") # which for some reason is smaller in# the graphical window # than Andorra but I cannot find any function to find the avalable region names in a map database Kjetil Halvorsen
> From kjetil at entelnet.bo Wed Nov 5 11:31:52 2003 > > but I cannot find any function to find the avalable region names in > a map database >They are in the .N file for the appropriate map. Try: library(maps) data(worldMapEnv) file.show(paste(Sys.getenv(worldMapEnv), "world.N", sep="/")) These ASCII files are in the form: region[:subregion] polygonNumber Ray Brownrigg
>>>>> "k" == kjetil <kjetil at entelnet.bo> disait:<snip> k> I also tried k>> map("worldHires","sweden") k>> map("worldHires","denmark") # which comes out very small since it k> # includes the Faroe k> # islands properly faraway and, just to know, how would you do to plot *only* continental denmark? The same applies for france, UK, ... -- Mathieu Ros Ph. D. student - "Canalizing selection using Bayesian models" INRA - Fish Genetics Unit (Paris)/Cell Genetics Unit (Toulouse) tel : (+0033)1 3465 3414 (FGU) / (+0033)5 6128 5305 (CGU) mail : ros at diamant.jouy.inra.fr
> Ivar Herfindal <Ivar.Herfindal at bio.ntnu.no> wrote: > > On Wed, 5 Nov 2003 11:28:42 +0100 (MET), Mathieu Ros > <mros at autan.toulouse.inra.fr> wrote: > > >>>>>> "k" == kjetil <kjetil at entelnet.bo> disait: > > > > <snip> > > k> I also tried > > > > k>> map("worldHires","sweden") > > k>> map("worldHires","denmark") # which comes out very small since it > > k> # includes the Faroe k> > > # islands properly faraway > > > > and, just to know, how would you do to plot *only* continental > > denmark? The same applies for france, UK, ... > > > Hello > > One simple way of doing it is to specify the xlim and ylim of your map, > e.g. library(maps) > map('world', 'Norway', xlim=c(5, 33), ylim=c(55, 75)) >But the 'best' way is RTFM! map("world", "Norway", exact=T) Ray Brownrigg