standardise_data: Standardise Input Data

View source: R/func_process_input_data.R

standardise_dataR Documentation

Standardise Input Data

Description

Internal function used to standardise the output from mapmixture::read_input_data().

Usage

standardise_data(df, type = "admixture")

Arguments

df

a data.frame.

type

type of file to process ("admixture" or "coordinates").

Value

A data.frame object.

Examples

# Standardise admixture data
df_admix <- data.frame(
  Site = c("London", "London", "Paris", "Paris", "Berlin", "Berlin",
   "Rome", "Rome", "Madrid", "Madrid"),
  Ind = c("London1", "London2", "Paris1", "Paris2", "Berlin1", "Berlin2",
   "Rome1", "Rome2", "Madrid1", "Madrid2"),
  Cluster1 = c(1.0, 0.9, 0.5, 0.5, 0.1, 0.1, 0, 0, 0, 0),
  Cluster2 = c(0, 0.10, 0.50, 0.40, 0.50, 0.40, 0.01, 0.01, 0.70, 0.80),
  Cluster3 = c(0, 0, 0, 0.10, 0.40, 0.50, 0.99, 0.99, 0.30, 0.20)
)
standardise_data(df_admix, type = "admixture")

# Standardise coordinates data
df_coords <- 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)
)
standardise_data(df_coords, type = "coordinates")

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