## Dataframe representing waypoint names, and latitude and longitude values
## in degrees, minutes and seconds
wp1 <- data.frame(
name = c("Nelson's Column", "Ostravice", "Tally Ho", "Washington Monument", "Null Island",
"Tristan da Cunha", "Mawson Peak", "Silvio Pettirossi International Airport"),
lat = c(513027.95, 493246.36, 480626.04, 385322.18, 0, -370642.26, -530617.21, -251424.56),
lon = c(-00740.53, 182354.82, -1224643.22, -770206.87, 0, -121719.07, 733102.22, -573109.21)
)
## Create "waypoints" object of degrees, minutes and seconds (fmt = 3)
as_waypoints(wp1, fmt = 3)
## Show as an ordinary R data frame
as.data.frame(wp1)
###
## Dataframe representing unnamed latitude and longitude
## values in decimal degrees
wp2 <- data.frame(
lat = c(51.507765, 49.54621, 48.107232, 38.889494, 0, -37.11174, -53.104781, -25.240156),
lon = c(-0.127924, 18.398562, -122.778671, -77.035242, 0, -12.28863, 73.517283, -57.519227)
)
## Create unnamed "waypoints" object of decimal degrees (default fmt = 1)
as_waypoints(wp2)
## Add waypoint names as row.names
row.names(wp2) <-
c("Nelson's Column", "Ostravice", "Tally Ho", "Washington Monument", "Null Island",
"Tristan da Cunha", "Mawson Peak", "Silvio Pettirossi International Airport")
wp2
## Show as an ordinary R data frame
as.data.frame(wp2)
rm(wp1, wp2)
Run the code above in your browser using DataLab