transform_df_coords: Transform Coordinates in Data Frame

View source: R/func_data_transformation.R

transform_df_coordsR Documentation

Transform Coordinates in Data Frame

Description

Internal function used to transform latitude and longitude coordinates in admixture data.frame.

Usage

transform_df_coords(df, crs)

Arguments

df

a data.frame containing site names, lat and lon coordinates and admixture data.

crs

a coordinate reference system.

Value

a data.frame with coordinates transformed.

Examples

df <- data.frame(
  site = c("London", "Paris", "Berlin", "Rome", "Madrid"),
  lat = c(51.51, 48.85, 52.52, 41.90, 40.42),
  lon = c(-0.12, 2.35, 13.40, 12.49, -3.70),
  Cluster1 = c(0.95, 0.5, 0.1, 0, 0),
  Cluster2 = c(0.05, 0.45, 0.45, 0.01, 0.75),
  Cluster3 = c(0, 0.05, 0.45, 0.99, 0.25)
)

transform_df_coords(df, crs = 3857)

mapmixture documentation built on April 3, 2025, 7:45 p.m.