Dear All,
I am so happy to inform you that this problem is now fixed. Great thanks to
all those who contributed. Barry Rowlingson was of great help and I'd like
to post his code for the benefit of others.
Regards
Ogbos

>
> # get the data:
> library(maps)
> data(worldMapEnv)
>
> # get coords in w$x and w$y:
> w = map("world")
>
> # make a matrix:
> wc=cbind(w$x,w$y)
>
> # strip NA values:
> wc=wc[!is.na(wc[,1]),]
>
> # write to a file with no headings, space-separated:
> write.table(wc, file = "my.fileb", sep=" ",row=FALSE,col=FALSE)
>
> ## now run the fortran converter and produce my.out:
> ## ./a.out  < my.fileb  >my.out
>
> # read it in:
> my = read.table("my.out")
>
> # this function re-inserts the NAs:
> rena = function(X,Z){
> Y=rep(NA,length(X))
> Y[!is.na(X)]=Z
> Y
> }
>
> # re-insert the NAs:
> xna = rena(w$x,my[,1])
> yna = rena(w$x,my[,2])
>
> # put a new map object together:
> wm=w
> wm$x=xna
> wm$y=yna
> wm$range=c(range(wm$x,na.rm=TRUE),range(wm$y,na.rm=TRUE))
>
> # need wrap=TRUE because some objects cross over from one side to the
> other:
> map(wm,wrap=TRUE)
>
> Barry
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to