davidperezmartorell / forestMap

Map of forests and studies or inventories during the time
0 stars 0 forks source link

como uno datos de las disturbance #150

Closed davidperezmartorell closed 6 months ago

davidperezmartorell commented 6 months ago

Hola Vero/Julen. como solicitaste, auqi tienes el issue donde expongo como divido los datos en el gráfico generl segun el disturbance en el codigo este en esta linea https://github.com/davidperezmartorell/forestMap/blob/cd233f7537e6ef6fbb1225d68cc6f13dcd8c95a8/getplotRichnessByDisturbanceAgeGeneral.R#L13

aqui el grupo de comandos

result_filtered <- mergedAssembleagesTaxon %>% filter(disturbance1_age_clean != "") %>% filter(disturbance1_age_clean != "none") %>% mutate(combined_disturbance = ifelse(disturbance1_age_clean %in% c("burning", "burning/logging/farming", "burning/farming"), "burning", ifelse(disturbance1_age_clean == "mining", "mining", ifelse(disturbance1_age_clean %in% c("logging", "logging/farming", "forest uses", "forest uses/logging"), "logging", ifelse(disturbance1_age_clean %in% c("cultivation","farming", "animal farming", "plantation", "plantation/logging"), "farming", "others")))))

VeruGHub commented 6 months ago

No habia visto el issue, sorry! Usa esto mejor:

... %>% mutate(disturbance1_age_clean = case_when(disturbance1_age_clean %in% c("animal farming", "cultivation", "farming") ~ "farming", disturbance1_age_clean %in% c("forest uses", "forest uses/logging", "logging", "plantation", "plantation/logging") ~ "forestry", disturbance1_age_clean == "burning" ~ "burning", disturbance1_age_clean == "mining" ~ "mining", disturbance1_age_clean == "none" ~ "none", TRUE ~ "other")

davidperezmartorell commented 6 months ago

hecho,este es el resultado image

subo el archivo a GITHUB