Hi Rui, I succeded to convert a coordinate from decimal to DMS formats but not the inverse!!!
dd<- -52.55684 c<-dd2dms(dd, NS = FALSE) c [1] 52d33'24.624"W > The use of char2dms() function is not so easy because I cannot yet read() the text file with the DMS coordinates (one col. with the points names, lat col. and long. col.)!!
nom lat long "D. antoinei" 6d04' S 50d12'W "D. antoinei" 3d45'S 49d40'W "D. antoinei" 3d1'49"N 53d6'24"W "D. barberoi" 13d03.3âS 71d32.7âW "D. barberoi" 10d59.3âS 75d25.5âW" "D. barberoi" 8d56.17âN 82d50.01âW "D. bihamatus" 6d04'S 50d12'W "D. bihamatus" 1d27'S 48d26'W "D. bihamatus" 12d39.3'S 71d13.9'W "D. diquis" 9d11âN 79d51âW "D. diquis" 7d45'18"N 77d41'06"W "D. greglamarrei" 4d43'N 52d24'W "D. greglamarrei" 4d02'16"N 52d40'21"W "D. greglamarrei" 3d1'20"N 53d5'41"W "D. greglamarrei" 4d36'37.6"N 52d16'44.5"W "D. greglamarrei" 6d04'S 50d12'W "D. greglamarrei" 4d54'S 73d40'W "D. hamatus" 15d 03' 48" N 90d 14' 22' W "D. hielkemai" 3d27'N 57d37'W "D. hielkemai" 3d20'56"N 55d26'18"W "D. hielkemai" 4d02'16"N 52d40'21"W "D. hielkemai" 3d1'20"N 53d5'41"W "D. hielkemai" 3d1'19"N 53d5'3"W "D. hielkemai" 4d40'19"N 58d41'4"W "D. hielkemai" 4d43'45"N 59d1'31"W "D. hielkemai" 4d44'54"N 59d1'36"W "D. hielkemai" 4d17'4"N 58d30'35"W "D. hielkemai" 4d20'2"N 58d47'18"W "D. hielkemai" 1d10'N 52d56'W "D. hielkemai" 6d04'S 50d12'W "D. hielkemai" 3d09'S 52d03'W "D. hielkemai" 3d45'S 49d40'W "D. hielkemai" 1d27'S 48d26'W "D. hielkemai" 12d39'10"S 71d15'28"W "D. hielkemai" 12d38'30"S 71d16'41"W "D. hielkemai" 12d39.3'S 71d13.9'W "D. hielkemai" 12.55261dS 70.11008W "D. hielkemai" 2d35.66'S 76d06.92'W "D. hielkemai" 3d54'02"S 73d33'25"W "D. hielkemai" 3d54'S 73d33'W "D. hielkemai" 4d54'S 73d40W "D. kanaari" 3d45'S 49d40'W "D. lewisi" 16d20.99' S 67d30.30'W "D. lissosternum" 4d54' S 73d40'W "D. parenthesis" 48d26'W 1d27'S "D. penatii" 11d50.05âN 85d58.83âW "D. penatii" 8d56.17âN 82d50.01âW "D. penatii" 8d47.14âN 82d57.58âW "D. penatii" 9d01.76âN 83d00.49âW "D. penatii" 10d26âN 84d01âW "D. peruvianus" 13d03.3âS 71d32.7âW "D. peruvianus" 16d25.95âS 67d47.07âW "D. pseudohamatus" 12d39.3âS 71d13.9âW "D. pusillus" 1d27'S 48d26'W "D. rogeri" 2d5'12"N 75d12'50"W "D. striatus" 3d54'02"S 73d33'25"W "D. striatus" 4d40'N 58d40'W "D. striatus" 4d40'19"N 58d41'4"W "D. striatus" 3d54'02"S 73d33'25"W "D. surinamensis" 3d 1'19" N 53d5'3"W "D. surinamensis" 4d40'19"N 58d41'04"W "D. surinamensis" 6d04'S 50d12'W "D. surinamensis" 3d54'02"S 73d33'25"W "D. yvesi" 8d47.14'N 82d57.58'W "D. yvesi" 9d01.76'N 83d00.49'W "D. yvesi" 8d56.17'N 82d50.01'W "D. yvesi" 8d41.141'N 83d31.117'W "D. yvesi" 8d47.14'N 82d57.58'W
Cheers Nicolas Hello, Here is the link to the archived versions of package measurements [1]. But the edit to that answer has another solution, with sp::char2dms and you are loading package sp. [1] https://cran.hafro.is/src/contrib/Archive/measurements/ Hope this helps, Rui Barradas Às 10:57 de 25/04/2022, Nicolas Degallier escreveu: > Hi Rui, > Thanks for the information. > Unfortunately, my versions of MacOS and of R are too old: > > install.packages("measurements") > Warning message: > package ‘measurements’ is not available (for R version 3.2.1) > > library(measurements) > Warning message: > le package ‘measurements’ a été compilé avec la version R 3.2.5 > There is no older package to do the same? > Cheers > Nicolas > Le 25 avr. 2022 à 11:12, Rui Barradas a écrit : >> Hello, >> >> See if this StackOverflow.com <http://StackOverflow.com> post [1] solves >> your problem. >> >> Also, examples should be minimal, you don't need all those packages to solve >> this problem. >> >> >> [1] https://stackoverflow.com/a/69485865/8245406 >> <https://stackoverflow.com/a/69485865/8245406> >> >> >> Hope this helps, >> >> Rui Barradas >> >> Às 21:43 de 24/04/2022, Nicolas Degallier escreveu: >>> Dear R Users, >>> I am using a 'simple' script to draw maps with points. >>> It runs fine with the following libraries: >>> library(sp) >>> library(maptools) >>> library(maps) >>> library(mapdata) >>> library(RColorBrewer) >>> library(MASS) >>> library(rgeos) >>> library(GISTools) >>> Until now, to prepare the input data, I have used manually some free net >>> converter because the number of points to plot was not too high. >>> Now I have much more points coordinates to convert from a GPS ° ' " (d m s) >>> format to a decimal format which will be accepted by the R script to build >>> maps. >>> My initial data is of the form (tab delimited text file): >>> nomlatlong >>> "D. antoinei"6°04' S50°12'W >>> "D. antoinei"3°45'S49°40'W >>> "D. antoinei"3°1'49"N53°6'24"W >>> "D. barberoi"13°03.3’S71°32.7’W >>> "D. barberoi"10°59.3’S75°25.5’W" >>> and I need them in the format (tab delimited): >>> nomlatlong >>> "D. antoinei"-11.944478527683975-71.28298997950684 >>> "D. antoinei"-12.833333-69.333333 >>> "D. antoinei"3.333333-60.283333 >>> "D. barberoi"-10.366667-67.683333 >>> "D. barberoi"-15.314500-55.970300 >>> Is there some 'simple' R script to do such a conversion? >>> I am using R v. 3.2.1. on a iMac OS 10.6.8. >>> May be this topic had already been resolved but I was unable to find the >>> result in the FAQs. >>> Cheers >>> Nicolas Degallier >>> <nicolas.degall...@free.fr <mailto:nicolas.degall...@free.fr>> >>> <omalo...@yahoo.fr <mailto:omalo...@yahoo.fr>> >>> Publications : >>> https://www.documentation.ird.fr/listes/parauteur/DEGALLIER/NICOLAS/tout/annee >>> >>> <https://www.documentation.ird.fr/listes/parauteur/DEGALLIER/NICOLAS/tout/annee> >>> ______________________________________________ >>> R-help@r-project.org <mailto:R-help@r-project.org> mailing list -- To >>> UNSUBSCRIBE and more, see >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> <https://stat.ethz.ch/mailman/listinfo/r-help> >>> PLEASE do read the posting guide >>> http://www.R-project.org/posting-guide.html >>> <http://www.R-project.org/posting-guide.html> >>> and provide commented, minimal, self-contained, reproducible code.
______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.