Installing R’s maps package on Ubuntu

[This article was first published on PlanetFlux, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I recently ran into trouble trying to install the R maps package on Ubuntu 10.04.  Here’s the error I was getting:

 ** arch – 
gcc -std=gnu99 -O3 -pipe  -g    Gmake.c   -o Gmake
Gmake.c: In function ‘get_lh’:
Gmake.c:111: warning: cast from pointer to integer of different size
Gmake.c:113: warning: cast from pointer to integer of different size
Gmake.c: In function ‘main’:
Gmake.c:211: warning: cast from pointer to integer of different size
Gmake.c:214: warning: cast from pointer to integer of different size
Gmake.c:217: warning: cast from pointer to integer of different size
Gmake.c:219: warning: cast from pointer to integer of different size
Gmake.c:221: warning: cast from pointer to integer of different size
Gmake.c:224: warning: cast from pointer to integer of different size
Gmake.c:227: warning: cast from pointer to integer of different size
gcc -std=gnu99 -O3 -pipe  -g    Lmake.c   -o Lmake
Lmake.c: In function ‘main’:
Lmake.c:223: warning: cast from pointer to integer of different size
Lmake.c:228: warning: cast from pointer to integer of different size
Lmake.c:230: warning: cast from pointer to integer of different size
Lmake.c:232: warning: cast from pointer to integer of different size
Lmake.c:235: warning: cast from pointer to integer of different size
Converting world to world2
f convert.awk < world.line > world2.line
/bin/bash: f: command not found
make: [world2.line] Error 127 (ignored)
make county.L state.L usa.L nz.L world.L world2.L italy.L france.L state.vbm.L state.carto.L
make[1]: Entering directory `/tmp/Rtmp4lXbpt/R.INSTALL375371de/maps/src’
./Lmake 0 s b county.line county.linestats ../inst/mapdata/county.L
./Lmake 0 s b state.line state.linestats ../inst/mapdata/state.L
./Lmake 0 s b usa.line usa.linestats ../inst/mapdata/usa.L
./Lmake 0 s b nz.line nz.linestats ../inst/mapdata/nz.L
./Lmake 0 s b world.line world.linestats ../inst/mapdata/world.L
./Lmake 0 s b world2.line world2.linestats ../inst/mapdata/world2.L
Cannot read left and right at line 1
make[1]: *** [world2.L] Error 1
make[1]: Leaving directory `/tmp/Rtmp4lXbpt/R.INSTALL375371de/maps/src’
make: *** [ldata] Error 2
ERROR: compilation failed for package ‘maps’
* removing ‘/usr/local/lib/R/site-library/maps’
ERROR: dependency ‘maps’ is not available for package ‘ramps’
* removing ‘/usr/local/lib/R/site-library/ramps’


The downloaded packages are in
‘/tmp/RtmpsAvFte/downloaded_packages’


After banging my head on it for awhile, I eventually found that if you 

  1. download the tar.gz from CRAN
  2. change line 55 of the Makefile to:awk -f convert.awk < world.line > world2.line

it will install fine.


To leave a comment for the author, please follow the link and comment on their blog: PlanetFlux.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)