Convert data into presence/absence data.

convert2presenceAbsence(df, threshold = 2, col2convert = 2:ncol(df))

Arguments

df

The dataframe containing the data to convert.

threshold

The threshold that defines presence (presence if >= threshold)

col2convert

A vector of the columns to convert. Default is all the columns but the first, which contains an age, a depth or a sampleID.

Value

A vector of unique taxonIDs.

Examples

df <- data.frame(matrix(1:25, ncol = 5))
colnames(df) <- paste(rep("col", 5), 1:5, sep = "")
convert2presenceAbsence(df, threshold = 15)
#>   col1 col2 col3 col4 col5
#> 1    1    0    0    1    1
#> 2    2    0    0    1    1
#> 3    3    0    0    1    1
#> 4    4    0    0    1    1
#> 5    5    0    1    1    1
convert2presenceAbsence(df, col2convert = 3:5)
#>   col1 col2 col3 col4 col5
#> 1    1    6    1    1    1
#> 2    2    7    1    1    1
#> 3    3    8    1    1    1
#> 4    4    9    1    1    1
#> 5    5   10    1    1    1