Hi Everyone,
I am new to R Language and was wondering if someone could help me convert my
latitude-longitude coordinates to cartesian coordiantes using geoXY() from SoDA
package? I have been uploading my coordinates from a text file into R (they
originate as a dataframe) and them converting them to a matrix using the
data.matrix() function. But I think I'm running into trouble when I try to
use the geoXY() function with the matrix data. This is what I've tried so
far, attached is the text file I've been using. It would be great if someone
could tell me what I'm doing wrong so I know for future reference.
xy <- read.table("SMSPA.txt")> head(xy)
X Y
V1 V2
1 X Y
2 49.02988 -99.3662
3 49.36558 -101.12703
4 49.64091 -99.65275
5 49.37323 -101.11609
6 49.36558 -101.12703> data.matrix(xy)
V1 V2
[1,] 1164 1168
[2,] 27 1166
[3,] 284 2
[4,] 338 1167
[5,] 285 1
[6,] 284 2>library(SoDA)
> geoXY(xy@latitude, xy@longitude, unit=1000)
Error in geoXY(xy@latitude, xy@longitude, unit = 1000) :
trying to get slot "latitude" from an object of a basic class
("matrix") with no slots> geoXY(V1@latitude, V2@longitude, unit=1000)
Error in geoXY(V1@latitude, V2@longitude, unit = 1000) :
object 'V1' not found> geoXY(xy)
Error in min(longitude, na.rm = TRUE) : 'longitude' is missing Thanks!
---------------
Leanne Heisler
Graduate Student
Department of Biology
University of Regina
[[alternative HTML version deleted]]