Skip to content

Commit

Permalink
Update stop_sensor.R
Browse files Browse the repository at this point in the history
Add documentation to each function
  • Loading branch information
cpetinon committed Jun 5, 2024
1 parent 7209173 commit 95d9d83
Showing 1 changed file with 40 additions and 10 deletions.
50 changes: 40 additions & 10 deletions stop_sensor.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#' @param date_range Date vector. example: c('2021-01-01','2022-01-01'). Full period if NULL (default).
#' @param segments Character vector. Selected road segment, all if NULL (default).
#' @param successive_day Integer. Number of day choosen. Default to 2
#' @param uptime_choice
#' @param uptime_choice Real. Uptime choosen. Default to 0.5
#'
#' @return enriched_data
#' @export
Expand Down Expand Up @@ -57,10 +57,25 @@ retrieve_missing_data<- function(enriched_data,
return(enriched_data)
}





#' @description
#' A short description...
#' Retrieve hours with no data
#'
#'
#' @param enriched_data enriched data.frame containing all the data for all your sensors
#' @param uptime_choice Real. Uptime choosen. Default to 0.5
#'
#' @return enriched_data
#' @export
#'
#' @import dplyr
#' @import lubridate
#'
#' @examples
#' retrieve_missing_hours(traffic)
#' retrieve_missing_hours(traffic,
#' uptime_choice=0.3)

retrieve_missing_hours<-function(enriched_data,uptime_choice)
{
enriched_data$date <- ymd_hms(enriched_data$date)
Expand All @@ -75,11 +90,26 @@ retrieve_missing_hours<-function(enriched_data,uptime_choice)
return(enriched_data)
}






#' @description
#' A short description...
#' Replace incomplete data with NA,
#'
#'
#' @param enriched_data enriched data.frame containing all the data for all your sensors
#' @param successive_day Integer. Number of day choosen. Default to 2
#' @param uptime_choice Real. Uptime choosen. Default to 0.5
#'
#' @return enriched_data
#' @export
#'
#' @import dplyr
#' @import lubridate
#'
#' @examples
#' replace_inactivity_period(traffic)
#' replace_inactivity_period(traffic,
#' uptime_choice=0.3,
#' successive_day=1)

replace_inactivity_period<-function (enriched_data,successive_day,uptime_choice)
{
Expand Down

0 comments on commit 95d9d83

Please sign in to comment.