Please provide a sample of the data and the code you have tried. If
"pts" is your data.frame read in from CSV and the long/lats describe
points within the mainland U.S. then this should show you sensible
points on the map:
require(maps)
map('state')
points(pts$long, pts$lat)
If not, investigate what you should expect with the actual numbers
themselves, add axes to the plot:
axis(1)
axis(2)
Do the values in long and lat make sense for that extent?
No one can tell if you need to "scale" (or transform . . .) the data
without any kind of reference to what they are. You aren't just mixing
up the order of longitude and latitude are you? R's spatial functions
generally use the "x, y" convention to match "long, lat"
order.
Also, R-Sig-Geo is a more targeted mailing list for questions like this.
Cheers, Mike.
On Fri, Apr 6, 2012 at 6:24 AM, Metametadata <Jeffrey064 at gmail.com>
wrote:> Hi everyone,
> I'm trying to input an excel datasheet with city names and lat+longs,
?that
> has already been converted to a .csv file and make a map using R with my
> data. ?My datasheet is 30 cities, with their lat+long, temp, elevation. So
> far all I'm able to do is load the datasheet into R, I installed the
map+
> maptools packages so I can see a map of the US in R, but I don't know
how I
> can make my data can show up on the map. ?I've read around that I need
to
> scale something but my data is so different than most peoples online, so I
> don't know if its just the way I set up my data in Excel. I want to
post my
> datasheet on the forum, but I don't know how to. ?I've tried using
"ggplot2"
> library to plot my points and to put the code in the map that we used,
which
> is this
>
> library(maps)
>
> map("state", interior = FALSE)
>
> map("state", boundary = FALSE, col="gray", add = TRUE)
>
> So ultimately all I need to figure out how to scale my points so that it
> fits with my map, and also once they are scaled how do I combined them? If
> you have any questions please let me know!
>
> Cheers!
>
>
> --
> View this message in context:
http://r.789695.n4.nabble.com/Inputing-Excel-data-into-R-to-make-a-map-tp4535941p4535941.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
Michael Sumner
Institute for Marine and Antarctic Studies, University of Tasmania
Hobart, Australia
e-mail: mdsumner at gmail.com