简体   繁体   English

如何将单元格格式从“:”更改为纬度和经度(度、分、秒)类型

[英]How can I change the cell format from ":" to lat and long (degree, minute, second) type

The data has 34773 rows and 28 column.数据有 34773 行和 28 列。 One of these columns contains the latitude and the other longitude information for each row.其中一列包含每行的纬度和其他经度信息。 But these coordinates are supposed to be separated in degrees minutes seconds (° ' ''), but instead they are separated by colons.但是这些坐标应该以度分秒(°''')分隔,而是用冒号分隔。 How can I change this?我怎样才能改变这个?

相关栏目

Hi enesson ,嗨,埃尼森

Be careful because you haven't read the names of the variables as its first line, that is, the header parameter.要小心,因为您还没有将变量的名称作为它的第一行,即header参数来读取。 So, you will have to adapt the second line of this code to your data.因此,您必须根据您的数据调整此代码的第二行。

As you can see here, I used the separate function according to this post .正如你在这里看到的,我根据这篇文章使用了separate的功能。 It may be useful for you!它可能对你有用!

library(tidyr)
df <- read.csv("your_data.csv", header = TRUE, sep = ";")
df1 <- separate(data = df, col = KUZEY, into = c("lat_degrees", "lat_minutes", "lat_seconds"), sep = ":")
df2 <- separate(data = df1, col = DOGU, into = c("lon_degrees", "lon_minutes", "lon_seconds"), sep = ":")

I hope this helps you我希望这可以帮助你

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM