Tutorial: Use Cases
tutorial.Rmd
# installed_packages <- rownames(installed.packages())
# if (!'LHTPicker' %in% installed_packages) {
# devtools::install_github("https://github.com/d2gex/LHTPicker", dep=TRUE)
# }
# Ensure knitr does run the vignette from the same folder as interactively
knitr::opts_knit$set(root.dir = dirname(getwd()))
library(LHTpicker)
1. Fetch wanted LHTs from FishLife
1.1 Inputted taxa details
A csv file with the taxon names you are after and the wanted LHTs is required as shown below
1.2 Fetching predicted LHTs
p_lht_picker <- PredictedLHTPicker$new(FishLife::FishBase_and_Morphometrics,
fishlife_context$lht_names,
fishlife_context$backtransform_function_list,
taxon_lhts_to_fetch)
predicted_lht_df <- p_lht_picker$pick_and_backtransform()
head(predicted_lht_df)
#> taxon Linf Winf K L50 M
#> 1 Trisopterus luscus 43.86770 833.9878 0.3737931 19.52203 0.5981946
#> 2 Pollachius pollachius 87.30785 5819.9735 0.1867131 34.71789 0.3085845
#> Amat Amax Temperature
#> 1 1.400562 6.458926 17.36961
#> 2 3.456610 12.138258 12.11773
2 Fetch updated LHTs given new data
2.1 Inputted predicting taxa details
A csv file with the taxon names you are after and the wanted-to-update LHTs is required as shown below
2.2 Fetching updated LHTs
u_lht_picker <- UpdatedLHTPicker$new(
FishLife::FishBase_and_Morphometrics,
taxon_lhts_to_update,
fishlife_context$updated_prefix,
fishlife_context$transform_function_list,
fishlife_context$backtransform_function_list,
fishlife_context$lht_names
)
updated_lht_df <- u_lht_picker$pick_and_backtransform()
head(updated_lht_df)
#> taxon Linf Winf K L50 M Amat Amax Temperature
#> 1 Trisopterus luscus 42.41 921 0.210 19.45 0.254 NA 9 14.3
#> 2 Pollachius pollachius 102.14 12045 0.193 41.60 0.284 NA 8 14.3
#> updated_Linf updated_Winf updated_K updated_M updated_L50 updated_Amax
#> 1 44.24669 846.1382 0.3422767 0.5655704 19.91196 7.024725
#> 2 95.11434 8399.8020 0.1878959 0.2989860 36.52335 11.118416
#> updated_Amat updated_Temperature
#> 1 1.445218 16.72769
#> 2 3.418150 13.05402