Eco-Flow / pollen-metabarcoding

A pipeline developled in collaboration with Exeter University
1 stars 0 forks source link

Pie chrt as output #2

Closed chriswyatt1 closed 3 months ago

chriswyatt1 commented 3 months ago

New container for r-processing (from Simon) New pie chart code and written into results folder to give a rough visual of the classifications.

SimonDMurray commented 3 months ago

Hi @chriswyatt1,

You do not need the line:

  1. og_tab <- classif so change code to utilise dataframe variable that already exists
  2. top10 <- head(sums\$order, n = 10) change to what we discussed about the percentage
  3. sums <- aggregate(size~order,og_tab,sum) 
    sums <- sums[order(sums\$size, decreasing = TRUE),] 
    top10 <- head(sums\$order, n = 10) 
    sums <- sums %>% mutate(legend_value = case_when(order %in% top10 ~ order, !(order %in% top10) ~ "OTHER" )) 
    pie_table <- aggregate(size~legend_value,sums,sum)

    This entire section could be made into a function as it is repeated 3 times, so just provide input to a function of (order, family and genus)