Skip to content

Commit

Permalink
version 1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Cañigueral authored and cran-robot committed Feb 6, 2024
1 parent a9c2a76 commit 257f348
Show file tree
Hide file tree
Showing 46 changed files with 392 additions and 448 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
@@ -1,6 +1,6 @@
Package: evprof
Title: Electric Vehicle Charging Sessions Profiling and Modelling
Version: 1.1.0
Version: 1.1.1
Authors@R:
person("Marc", "Cañigueral", , "marc.canigueral@udg.edu", role = c("aut", "cre", "cph"),
comment = c(ORCID = "0000-0001-9724-5829"))
Expand All @@ -24,9 +24,9 @@ Language: en-US
LazyData: true
RoxygenNote: 7.2.3
NeedsCompilation: no
Packaged: 2024-01-30 00:25:18 UTC; mcanigueral
Packaged: 2024-02-05 15:56:41 UTC; mcanigueral
Author: Marc Cañigueral [aut, cre, cph]
(<https://orcid.org/0000-0001-9724-5829>)
Maintainer: Marc Cañigueral <marc.canigueral@udg.edu>
Repository: CRAN
Date/Publication: 2024-01-30 00:40:02 UTC
Date/Publication: 2024-02-05 22:50:06 UTC
88 changes: 43 additions & 45 deletions MD5
@@ -1,19 +1,19 @@
c96525ee428d6002e189b8e12635ff10 *DESCRIPTION
9faa179c32209ba466db6d5d83bcb7fb *NAMESPACE
be5eef26de13063cf313009e7ec1677e *NEWS.md
b35c4c551a87ac9ceda5c0e8d2a9ce5e *R/clustering.R
49bfe15a2e9f1bbc4b0b8b8cbcab7acc *R/data.R
3fd6fe919593a7c2e481bd5c7ca4f27e *R/exploration.R
794d2f0c4c7c91c618021836df1bc1bf *R/modelling.R
9fe86adcd870df013505ee1f13e1ec8a *DESCRIPTION
fcc2ca471a4b59355c21ce2c9d1f0a1a *NAMESPACE
954b5b0ba2e926fc4d5474b87c1e78f8 *NEWS.md
a383b1dc42e7950cfa6b998023d1fa4e *R/clustering.R
a6d0c58e12a1f1ae92c074ebcf043701 *R/data.R
63e957a463b4f586872143e27881fe3b *R/exploration.R
35f12fae423dabc6f4489031545ffe3c *R/modelling.R
77bf9b420ca315d87755518b6982c06a *R/package_utils.R
65c8349534a85c122cb2f21f97a9ce27 *R/preprocessing.R
9a9e27cb21aa5086d5387a17e8f342c8 *R/preprocessing.R
31947b3126783aa2749dc2aef8855a9b *R/profiling.R
d0c4b6446ee70d1a99bcdf9bd36f166e *README.md
ca92612c359a079d6fbda517be2ed926 *build/vignette.rds
9de514546ce47535410a55fdae4a27ac *data/california_GMM.rda
b8f25843c7bbd51a8a95ac9af33b621e *data/california_GMM.rda
80ccd1f35fdbc3bdc043ba254b86c8b8 *data/california_ev_model.rda
07c23309b23d7f7aa9371219ac719731 *data/california_ev_sessions.rda
7a2187e38d0480684f7ead3d753bb175 *data/california_ev_sessions_profiles.rda
8fe97f9bd51af4b5355ef726042604d3 *data/california_ev_sessions.rda
513fe88ce9cacc2756956e7649d73a37 *data/california_ev_sessions_profiles.rda
66b3acfb7bac463b3fe35a5aa5b4414b *data/sessions_feature_names.rda
465992bd9176d7911cc54633e6de098a *data/sessions_summary_feature_names.rda
662cd0191c3d22289ccf758ecb4ce976 *inst/doc/evmodel.R
Expand All @@ -22,65 +22,63 @@ ca92612c359a079d6fbda517be2ed926 *build/vignette.rds
7c173a67481270a68ff9101cb21badbd *inst/doc/sessions-format.R
4b6cf81408beeb1904ea368a732a2463 *inst/doc/sessions-format.Rmd
3f89a5e88ba6ec5e97f74c0b714b8ab6 *inst/doc/sessions-format.html
20aff559b2c2c7c635300c0a8032ec75 *man/california_GMM.Rd
da9639127203c34ae8b4aac1d8009b81 *man/california_GMM.Rd
8278c42bd4275ab4664f81cdebb96c9b *man/california_ev_model.Rd
8499fe2b32a67660c41d73c83744011d *man/california_ev_sessions.Rd
6adc1aab217604d24f75040593c0d6b4 *man/california_ev_sessions_profiles.Rd
f62a8f36258ce1e21d315be96ecd9fce *man/choose_k_GMM.Rd
375930cb4e20b6232bf9842c542a9c8e *man/cluster_sessions.Rd
1601ef1a40821ea75bf42414a4a0f271 *man/convert_time_dt_to_num.Rd
b9826a4ac900d3b0c408fb2ba69944dd *man/convert_time_dt_to_plot_dt.Rd
e5a89215616c892c14c59d07b20da3ac *man/convert_time_dt_to_plot_num.Rd
cef86402013883c398c0fd22e6bda9d6 *man/convert_time_num_to_chr.Rd
c795f8eda44f53c5f77d8d9f526df4ef *man/convert_time_num_to_period.Rd
9dcb7d83ebc6e2055d716e50948190ed *man/convert_time_num_to_plot_num.Rd
850b0fc612eb7f8df3458afefe5a4839 *man/cut_sessions.Rd
ed59f13165776142a75ed61616edf056 *man/choose_k_GMM.Rd
d01bcc2b8ed5bcd33d20e83885b188a7 *man/cluster_sessions.Rd
f108406cc93b1acd3b0a020e20b7b152 *man/convert_time_dt_to_plot_dt.Rd
3c9e92e61be954ae02d8967da0e5abba *man/convert_time_dt_to_plot_num.Rd
b9fea58b43a2780fea6e850fd3247fcc *man/convert_time_num_to_chr.Rd
0699d10192af71ae60c53443d9a98460 *man/convert_time_num_to_period.Rd
4df7739663395a95071ebd84e84d025b *man/cut_sessions.Rd
7ba1a91adc1a79ccde559bfb3126e44a *man/define_clusters.Rd
205d838747a3bcefa4cc9d6ce9679c02 *man/detect_outliers.Rd
a4e9e863b1618e957c71256694e15f61 *man/divide_by_disconnection.Rd
10dbf80742caa348f7514eac8762375f *man/divide_by_timecycle.Rd
654de6c9344a1fb74eb1225db24340fc *man/drop_outliers.Rd
ca646c7540951111f3797d74a7a9a137 *man/detect_outliers.Rd
dd7daf6a83d751eac14b7bdb30d0f7ed *man/divide_by_disconnection.Rd
6c604f6723c5dd1010ff627e24b80b0c *man/divide_by_timecycle.Rd
031325d55c7cfd047b19aaf02bd1ff71 *man/drop_outliers.Rd
749ad31e388a934da20a17773306bbf9 *man/figures/logo.png
236e6df60d74a8b9de2f4918add7beb8 *man/get_charging_rates_distribution.Rd
063a5fb513b2e2312aee23be24aa1ae1 *man/get_connection_model_mclust_object.Rd
acd1779ce44841587e7ae34f112ff1b0 *man/get_connection_model_mclust_object.Rd
4c56fe2a8e10f788e1e25ee370653ace *man/get_connection_model_params.Rd
ae08273d7d7d2214497b1b0db9b2190d *man/get_connection_models.Rd
b90de871f3671e163b9f35499cea2cf0 *man/get_daily_avg_n_sessions.Rd
09249f16969656bdb0cc23f76e0023eb *man/get_daily_n_sessions.Rd
9c1552e45fb2bb48bee340444b3f7580 *man/get_dbscan_params.Rd
8ea73b937f0f4e562649cb64d02502f4 *man/get_dbscan_params.Rd
7afd96657ccf87b48f157263ac011d0c *man/get_division_line.Rd
55c231dad0c46027b2141b475f0731bb *man/get_energy_model_mclust_object.Rd
040c1f72de82cfb4c5ec69ce0c231e89 *man/get_energy_model_parameters.Rd
aadb8f6bd871a7b3805c74d8b1dec09a *man/get_energy_models.Rd
e9ec43500eb7d7da09ecff9ff7335095 *man/get_energy_model_parameters.Rd
739a83c3c3a5d906652299f5aad0c02a *man/get_energy_models.Rd
55ecffca9becdbaf8baa60a82381c429 *man/get_ev_model.Rd
9b5a555a216fe9dcc6683f78e92ed375 *man/mutate_to_log.Rd
dd51a03c56934d7cdad757ec40ad239a *man/plot_bivarGMM.Rd
9773a0801023f25142f2da012e9319c3 *man/plot_density_2D.Rd
5bc059f1d15a61a60e2912e208618498 *man/plot_density_3D.Rd
c817a28661229bf246d463b777b6c3bb *man/plot_division_lines.Rd
0143ca8beba6195325e8918f141d5f09 *man/mutate_to_log.Rd
971c13cc0467a5fc422e37d8bc68dd0a *man/plot_bivarGMM.Rd
676e02a986292270491025f16c11cebb *man/plot_density_2D.Rd
a9ecac5d7581642d7780cbf29612a43a *man/plot_density_3D.Rd
de725c2cde1c0735c014e692ac7ea1db *man/plot_division_lines.Rd
befd767e50965f616887ee3938cd6921 *man/plot_energy_models.Rd
e93eb65d9f82eab786483e123bcca05a *man/plot_histogram.Rd
88bc4d08d677dba1c0bb1f6e13ae2623 *man/plot_histogram_grid.Rd
74acbeac8f0c85bd7ca36e649766a679 *man/plot_kNNdist.Rd
d9222cd6a22185e3734e29291ad4a606 *man/plot_model_clusters.Rd
fdcc22da4e043770c575466a204acaf3 *man/plot_outliers.Rd
b028644e3ccf4f8f466d2471b4079b2f *man/plot_points.Rd
7d342737216857878cac0c5aa9d55c85 *man/plot_kNNdist.Rd
4c98a92553d6ca74ceb19eea5c237f80 *man/plot_model_clusters.Rd
f3edd433b2b985efc121859668bb6bd4 *man/plot_outliers.Rd
abf1941078340380fc5c29f938facacc *man/plot_points.Rd
05ef1d2e16e791459e51059adb0aaf71 *man/print.evmodel.Rd
9229b7aa474b7345c92595ff93e7a313 *man/read_ev_model.Rd
ec4377fa1e8c87847d73f411706c94d2 *man/round_to_half.Rd
4c93ce55df8c2d682d7621bf39aa56a2 *man/round_to_half.Rd
dd0c09ca9e5c232accaac33bc91538aa *man/round_to_interval.Rd
b04209585a8adf60ae2d6721e993afb4 *man/save_clustering_iterations.Rd
e16c039a3190549be3404a3cd3ca9574 *man/save_clustering_iterations.Rd
aedeb23173b2b4024312c6fdfd594dfb *man/save_ev_model.Rd
2fd468136b57e6fc7d3ab59d9b2e978b *man/sessions_feature_names.Rd
dad02fd42d30473859cd09f9089c8ef8 *man/sessions_summary_feature_names.Rd
b9f563e33ab0137ef64ae0173e87b9eb *man/set_profiles.Rd
e48e114ec50c3d992e337e72b9b52e81 *man/summarise_sessions.Rd
0622a97a2aaa3c342f09636052c2d7f5 *tests/spelling.R
c5a8ebd44a1983bb51d26baacb5767b1 *tests/testthat.R
b90c0fffdc8012dc53be3ff3c6625eb1 *tests/testthat/test-clustering.R
cfb040d89de464f2fede6660e8cc5371 *tests/testthat/test-exploration.R
86bf6894d8da9b5b29b399061b97713b *tests/testthat/test-modelling.R
ebd1ac6e2f58f6c696d02cc6d1b2e981 *tests/testthat/test-preprocessing.R
665205e6b89005c0b133a08fef2714e5 *tests/testthat/test-profiling.R
b67aee9da687822bb38595194ab7b0e8 *tests/testthat/test-clustering.R
55c84d782d7d0e8a2191292c905a83b5 *tests/testthat/test-exploration.R
5548b911f4dbfcd8ec493ce5a3660799 *tests/testthat/test-modelling.R
442e65726d3cfb14c2c1aa56ee1a7e5f *tests/testthat/test-preprocessing.R
9ce7fd1b15745e74e79b4afe359db068 *tests/testthat/test-profiling.R
14a37235523ed1ee6dff1ce40c01f867 *vignettes/evmodel.Rmd
4b6cf81408beeb1904ea368a732a2463 *vignettes/sessions-format.Rmd
1 change: 0 additions & 1 deletion NAMESPACE
Expand Up @@ -14,7 +14,6 @@ export(get_connection_models)
export(get_daily_avg_n_sessions)
export(get_daily_n_sessions)
export(get_dbscan_params)
export(get_division_line)
export(get_energy_models)
export(get_ev_model)
export(plot_bivarGMM)
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
@@ -1,3 +1,9 @@
# evprof 1.1.1

* Improved the consistency of the provided example data sets
* Function `plot_points` can configure `start` hour when `log = TRUE`


# evprof 1.1.0

* Energy GMM inside of `evmodel` also contain the `ratio` of every `charging_rate`
Expand Down
21 changes: 13 additions & 8 deletions R/clustering.R
Expand Up @@ -11,7 +11,6 @@
#' @param log logical, whether to transform `ConnectionStartDateTime` and
#' `ConnectionHours` variables to natural logarithmic scale (base = `exp(1)`).
#' @param start integer, start hour in the x axis of the plot.
#' This is only used when `log = FALSE`.
#'
#' @keywords internal
#' @returns mclust object
Expand All @@ -21,9 +20,12 @@
get_connection_model_mclust_object <- function(sessions, k, mclust_tol = 1e-8, mclust_itmax = 1e4,
log = FALSE, start = getOption("evprof.start.hour")) {
if (!log) {
sessions["ConnectionStartDateTime"] <- convert_time_dt_to_plot_num(sessions[["ConnectionStartDateTime"]], start)
sessions["ConnectionStartDateTime"] <- convert_time_dt_to_plot_num(
sessions[["ConnectionStartDateTime"]],
start = start
)
} else {
sessions <- mutate_to_log(sessions)
sessions <- mutate_to_log(sessions, start)
}
sessions_cluster <- sessions[,c("ConnectionStartDateTime", "ConnectionHours")]
Mclust(sessions_cluster, G = k, control = emControl(tol = mclust_tol, itmax = mclust_itmax))
Expand Down Expand Up @@ -51,6 +53,13 @@ get_connection_model_params <- function(mclust_obj) {

#' Visualize BIC indicator to choose the number of clusters
#'
#' The Baysian Information Criterion (BIC) is the value of the maximized
#' loglikelihood with a penalty on the number of parameters in the model,
#' and allows comparison of models with differing parameterizations and/or
#' differing numbers of clusters. In general the larger the value of the BIC,
#' the stronger the evidence for the model and number of clusters
#' (see, e.g. Fraley and Raftery 2002a).
#'
#' @param sessions tibble, sessions data set in evprof
#' [standard format](https://mcanigueral.github.io/evprof/articles/sessions-format.html).
#' @param k sequence with the number of clusters, for example 1:10, for 1 to 10 clusters.
Expand All @@ -59,7 +68,6 @@ get_connection_model_params <- function(mclust_obj) {
#' @param log logical, whether to transform `ConnectionStartDateTime` and
#' `ConnectionHours` variables to natural logarithmic scale (base = `exp(1)`).
#' @param start integer, start hour in the x axis of the plot.
#' This is only used when `log = FALSE`.
#'
#' @returns BIC plot
#' @export
Expand Down Expand Up @@ -94,7 +102,6 @@ choose_k_GMM <- function(sessions, k, mclust_tol = 1e-8, mclust_itmax = 1e4,
#' @param log logical, whether to transform `ConnectionStartDateTime` and
#' `ConnectionHours` variables to natural logarithmic scale (base = `exp(1)`).
#' @param start integer, start hour in the x axis of the plot.
#' This is only used when `log = FALSE`.
#'
#' @returns list with two attributes: sessions and models
#' @export
Expand Down Expand Up @@ -158,7 +165,6 @@ cluster_sessions <- function(sessions, k, seed, mclust_tol = 1e-8, mclust_itmax
#' @param log logical, whether to transform `ConnectionStartDateTime` and
#' `ConnectionHours` variables to natural logarithmic scale (base = `exp(1)`).
#' @param start integer, start hour in the x axis of the plot.
#' This is only used when `log = FALSE`.
#'
#' @export
#' @returns nothing, but a PDF file is saved in the path specified by parameter `filename`
Expand Down Expand Up @@ -238,7 +244,6 @@ get_ellipse <- function(mu, sigma, alpha = 0.05, npoints = 200) {
#' @param log logical, whether to transform `ConnectionStartDateTime` and
#' `ConnectionHours` variables to natural logarithmic scale (base = `exp(1)`).
#' @param start integer, start hour in the x axis of the plot.
#' This is only used when `log = FALSE`.
#'
#' @returns ggplot2 plot
#' @export
Expand Down Expand Up @@ -291,7 +296,7 @@ plot_bivarGMM <- function(sessions, models, profiles_names = seq(1, nrow(models)
if (!log) {
sessions["ConnectionStartDateTime"] <- convert_time_dt_to_plot_num(sessions[["ConnectionStartDateTime"]], start)
} else {
sessions <- mutate_to_log(sessions)
sessions <- mutate_to_log(sessions, start)
}

plot <- ggplot(data = sessions, aes(x = .data$ConnectionStartDateTime, y = .data$ConnectionHours)) +
Expand Down
9 changes: 5 additions & 4 deletions R/data.R
Expand Up @@ -49,13 +49,14 @@
#' More information about the development of the model in the evprof website:
#' <https://mcanigueral.github.io/evprof/articles/california.html>
#'
#' @format list of two tibbles
#' @format list
#' \describe{
#' \item{connection_models}{Tibble with the parameters of the bi-variate
#' (connection start time and connection duration) GMM from the working days
#' sessions of the California data set}
#' (connection start time and connection duration) GMM from the working/weekend days
#' sessions of the California data set obtained from `get_connection_models`}
#' \item{energy_models}{Tibble with the parameters of the uni-variate
#' (energy) GMM from the working days sessions of the California data set}
#' (energy) GMM from the working/weekend days sessions of the California data set
#' obtained from `get_energy_models`}
#' }
#' @source <https://mcanigueral.github.io/evprof/articles/california.html>
#' @keywords internal
Expand Down

0 comments on commit 257f348

Please sign in to comment.