I have this kind od data
x - read.table(text=
 Log    lat
3025.264 901.331
3039.237 810.811
3137.760 806.040
3141.190 806.557
3141.229 806.622
3138.891 806.281,
               header=TRUE,
stringsAsFactors=FALSE)
I what to insert â:â after every first
two numbers in
On 10/23/2013 08:05 PM, Peter Maclean wrote:
I have this kind od data
x- read.table(text=
 Log    lat
3025.264 901.331
3039.237 810.811
3137.760 806.040
3141.190 806.557
3141.229 806.622
3138.891 806.281,
               header=TRUE,
stringsAsFactors=FALSE)
I what to
Hi,
Try:
x$Log -
gsub(^(\\d{2})(\\d{2})\\.(\\d{3}),\\1:\\2:\\3E,sprintf(%.3f,x$Log))
x$lat -
gsub(^(\\d{1})(\\d{2})\\.(\\d{3}),\\1:\\2:\\3S,sprintf(%.3f,x$lat))
x
# Log lat
#1 30:25:264E 9:01:331S
#2 30:39:237E 8:10:811S
#3 31:37:760E 8:06:040S
#4 31:41:190E 8:06:557S
#5
3 matches
Mail list logo