R/clean_input.R

Defines functions clean_input

Documented in clean_input

#' Title
#'
#' @param genotypes data.table
#'
#' @return data.table
#' @export
#'
#' @importFrom data.table tstrsplit
#' @importFrom data.table setDT
#' @importFrom data.table as.data.table
clean_input <- function(genotypes) {

    o <- genotypes |>
        lapply(function(q) q |> tstrsplit(split = "\\/", names = FALSE) |> setDT()) |>
        lapply(function(q) {colnames(q) <- ncol(q) |> seq_len() |> as.character(); return(q) }) |>
        as.data.table()

    colnames(o)[1] = "tree_id"

    return(o)



}

Try the acoRn package in your browser

Any scripts or data that you put into this service are public.

acoRn documentation built on Oct. 2, 2024, 5:07 p.m.