Dear David, Thanks a lot for your kind reply.
Unfortunately, distm() can not give me what I want. distm(), output the distance matrix (but not in dist class). Fortunately, I just realized that as.dist() from base R can convert matrix to dist class. Thanks again. Best Jian-Feng, 2011/11/8 David L Carlson <dcarl...@tamu.edu> > Look at distm() in package geosphere. > > ---------------------------------------------- > David L Carlson > Associate Professor of Anthropology > Texas A&M University > College Station, TX 77843-4352 > > > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On > Behalf Of Mao Jianfeng > Sent: Tuesday, November 08, 2011 8:22 AM > To: r-help@r-project.org > Cc: bossa.pack...@gmail.com > Subject: [R] from points in Lon/Lat to physical distance in dist class > > Dear R-listers, > > Here, I would like to hearing helps from you. > > I have GPS data (multiple points in the geographic scale) in > longitude/latitude. I intend to calculate > distance (in kilometer) among such points and output the distance matrix in > dist class. > > I have gotten some progress, but I still can not get final goal. Could > please give me any directions/advice? > > This email cc. to Mr. Pierre, the author of BoSSA package. > > Thanks a lot in advance. > > Best wishes, > > Jian-Feng, Mao > > ######################################### > What I have gotten are > (1) distance among GPS points could be calculated by distGPS() function in > BoSSA package. But, it can > not output the distance in dist class. And, I do not know how to convert > such distance matrix to dist class. > > (2) dist() function in base R can calculate distance among units and export > it in dist class. But, it could not > be used to work on points in lon/lat. > > (3) some dummy codes > # (3.1) generate dummy points in lon/lat (in degree) > points <- data.frame(lon=seq(95, 105),lat=seq(35, 45)) > > # (3.2) calculate distance between points using distGPS() > > library(BoSSA) > > Geodist<-distGPS(points) > > str(Geodist) > class(Geodist) > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. > > -- Jian-Feng, Mao Post doc Dept. of Molecular Biology Max Planck Institute for Developmental Biology Spemannstrasse 37-39 72076 Tuebingen Germany Blog: http://maojf.blogspot.com/ [[alternative HTML version deleted]] ______________________________________________ R-help@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.