View source: R/5_maxN_values_studied_species_functions.R
automat.maxN.spbysp | R Documentation |
fish_speed = NULL
#'
#' @param os a chacaretr string refering to the operating system used as the
#' parallelisation process differs following the os. can either be "windows" or
#' "linux". (mac not done)
#'
#' @return a dataframe with five columns: maxN,SmaxN, maxN_row,
#' Species_nm, Poses
#'
#' @importFrom magrittr %>%
#'
#' @export
#'#' Create a dataframe containing maxN values for the studied species and
#' the three poses
#'
#' This function computes a dataframes containing maxN,SmaxN, maxN_row,
#' for a given set of species and the three poses. This function uses
#' parallelisation.
#'
#' @param species_set a vector containing the latin name of the studied species
#' given with no space but underscore "_" between Genera and Species names
#'
#' @param abund_list a list gathering the abundance dataframes of the different
#' Poses (dataframes with cameras = columns and time = rows)
#'
#' @param dist_df a numerical dataframe containing the distance between each
#' pair of camera. There are as many rows as there are cameras and there are
#' as many columns as there are cameras, thus the dataframe is symmetrical
#' and the diagonal is filled with 0. Rows names and columns names
#' must be cameras names. BE CAREFUL that the cameras are
#' the same and in the same order in the dist_df and in the abund_df!
#'
#' @param fish_speed a numerical value refering to the maximal speed of the
#' studied species. Speed must be given in meters per second. If the
#' computation of maxN values should not take into account fish speed (that is
#' to say if the camera pooling is done at the second level),
#' fish_speed = NULL
#'
#' @param os a chacaretr string refering to the operating system used as the
#' parallelisation process differs following the os. can either be "windows" or
#' "linux". (mac not done)
#'
#' @return a dataframe with five columns: maxN,SmaxN, maxN_row,
#' Species_nm, Poses
#'
#' @importFrom magrittr %>%
#'
#' @export
#'
automat.maxN.spbysp(species_nm, abund_list, dist_df, fish_speed, os, nb_cores)
species_nm |
a caracter string containing the latin name of the studied species given with no space but underscore "_" between Genera and Species names |
abund_list |
a list gathering the abundance dataframes of the different Poses (dataframes with cameras = columns and time = rows) |
dist_df |
a numerical dataframe containing the distance between each pair of camera. There are as many rows as there are cameras and there are as many columns as there are cameras, thus the dataframe is symmetrical and the diagonal is filled with 0. Rows names and columns names must be cameras names. BE CAREFUL that the cameras are the same and in the same order in the dist_df and in the abund_df! |
fish_speed |
a numerical value refering to the maximal speed of the
studied species. Speed must be given in meters per second. If the
computation of maxN values should not take into account fish speed (that is
to say if the camera pooling is done at the second level),
@param os a chacaretr string refering to the operating system used as the parallelisation process differs following the os. can either be "windows" or "linux". (mac not done) @param nb_cores is a nuemric value refering to the number of cores on which the process should be parallelised (do not need more than 3 cores as 3 poses) |
a dataframe with five columns: maxN,SmaxN, maxN_row, Species_nm, Poses
maxN_all <- as.data.frame(matrix(ncol = 5, nrow = 1)) colnames(maxN_all) <- c("species_nm", "pose_nb", "maxN", "SmaxN", "SmaxN_timestep")
no_cores <- parallel::detectCores(logical = TRUE)
cl <- parallel::makeCluster(no_cores-1) doParallel::registerDoParallel(cl)
clean_abund_list <- abund_listwhich(names(abund_list) %in% species_set)
maxN_all <- maxN_allwhich(! is.na(maxN_all$species_nm)),
stopCluster(cl)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.