I am a statistician with no background in GIS so apologies for the newbie question.
We routinely use R for a range of statistical and graphic analysis and are interested in using its map library to superimpose statistical graphics onto a map of New Zealand. Drawing a map of New Zealand is easy, as is adding cities. But as far as I can tell to project more data onto the maps I need latitude and longitude information.
I have a database of key locations of interest to us with grid references in NZMG or NZTM projections. I've found the technical instructions on converting to lat and long here, and conceivably could write code in R that applies this process. But I've also found various web calculators that will do this for a specific point, so there must be relatively accessible software that does this automatically (I need to do it for about 2500 locations).
So, one version of my question is: how do I easily convert, in R or Excel, a list of NZMG or NZTM projections into latitude and longitude.
An alternative version of the question is: if I don't really need to convert them, is there some way I don't understand that the map projection packages in R can automatically project these locations onto a map?
Apologies again if I have missed some fundamental point.
EDIT / ADDITION after @whuber's helpful link to an almost identical question
Ok, so I've installed the proj4 library but yes I am having difficulty in specifying my proj4string. If my understanding of this page is correct the NZTM system is basically a universal transverse mercator based on WGS-84. If I understand this map correctly I should by in zone 60 (or 59, as they both cover New Zealand? but neither work anyway). And if I understand proj4 properly the code below should be close. One of those "ifs" must be wrong...
1781304 E 5485722 N is a "NZTM" coordinate in my database that should be a suburb of Wellington, in the south of the north island.
library(proj4) library(maps) library(mapproj) proj4string <- "+proj=utm +zone=60 +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs " p <- project(c(1781304, 5485722), proj=proj4string, inverse=T) # should be wellington map('nz') points(p, p, cex=5, pch=19, col=2) points(-p, p, cex=5, pch=19, col=2) # In case I've misunderstood the sign. Appears on map but in the sea