2021年4月22日星期四

Change Lat/Long coordinates to positive and negative decimals

Hello I have a set of data that holds Latitude and Longitude Coordinates in the format: "22.0N", "2.0E" and I want to be able to work with that data numerically. I'm new to R, so I'm wondering if anyone can help me convert the column of data (fbdata$Latitude (Deg)) to something more usable. i.e. Southern latitudes and Eastern Longitudes negative and without any letters so that I can change it from a character class. This was the code I came up with that obviously doesn't work (thats why I'm here!)

for (i in fbdata$Latitude..Deg.) {    if (endsWith(fbdata$Latitude..Deg.[i],"S")) {      print (fbdata$Latitude..Deg.[i]) #paste0 ("-",fbdata$Latitude..Deg.)    }  }  

Any help would be great!

https://stackoverflow.com/questions/67222927/change-lat-long-coordinates-to-positive-and-negative-decimals April 23, 2021 at 09:44AM

没有评论:

发表评论