Installing R’s maps package on Ubuntu

April 16, 2012
By

(This article was first published on PlanetFlux, and kindly contributed to R-bloggers)

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 on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags: ,

Comments are closed.

Sponsors

Mango solutions



RStudio homepage



Zero Inflated Models and Generalized Linear Mixed Models with R

Quantide: statistical consulting and training

datasociety

http://www.eoda.de





ODSC

ODSC

CRC R books series





Six Sigma Online Training









Contact us if you wish to help support R-bloggers, and place your banner here.

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)