Skip to content

Commit

Permalink
Adhere to coding and documentation standards
Browse files Browse the repository at this point in the history
Signed-off-by: Maximilian Löffler <s8maloef@stud.uni-saarland.de>
  • Loading branch information
maxloeffler committed May 6, 2024
1 parent 4d2ebd2 commit 4b56d29
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/test-split-data-time-based.R
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ patrick::with_parameters_test_that("Split a data object time-based (split.basis
expect_equal(min(issue.data$date), as.POSIXct("2016-07-12 15:59:25"))
expect_equal(max(issue.data$date), as.POSIXct("2016-07-12 16:06:01"))

# split by 'mails' and 'issues' without sliding window
# split by 'mails' and 'issues'
results = split.data.time.based(project.data, time.period = "1 min",
split.basis = c("mails", "issues"), sliding.window = test.sliding.window)

Expand Down
8 changes: 4 additions & 4 deletions util-split.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ requireNamespace("lubridate") # for date conversion
#' time-sized windows for all ranges. If set, the \code{time.period} and \code{bins} parameters are ignored;
#' consequently, \code{sliding.window} does not make sense then either.
#' [default: NULL]
#' @param split.basis the data source to use as the basis for split bins, either 'commits', 'mails', 'issues'
#' @param split.basis the data source to use as the basis for split bins, either 'commits', 'mails', 'issues',
#' or an arbitrary combination of them
#' [default: "commits"]
#' @param sliding.window logical indicating whether the splitting should be performed using a sliding-window approach
Expand All @@ -67,7 +67,7 @@ split.data.time.based = function(project.data, time.period = "3 months", bins =
sliding.window = FALSE, project.conf.new = NULL) {

# ensure 'split.basis' defaults to 'commits' if not defined
# and allow it to be a vector if explicitly wanted
# and allow it to contain multiple data sources if explicitly wanted
if(!hasArg("split.basis")) {
split.basis = match.arg.or.default(split.basis, several.ok = FALSE, default = "commits")
} else {
Expand Down Expand Up @@ -899,7 +899,7 @@ split.network.by.bins = function(network, bins, bins.vector, bins.date = NULL, r
#' @param split.by.time logical indicating whether splitting is done time-based or activity-bins-based
#' @param number.windows see \code{number.windows} from \code{split.data.time.based}
#' [default: NULL]
#' @param split.basis the data source to use as the basis for split bins, either 'commits', 'mails', 'issues'
#' @param split.basis the data source to use as the basis for split bins, either 'commits', 'mails', 'issues',
#' or an arbitrary combination of them
#' [default: "commits"]
#' @param sliding.window logical indicating whether the splitting should be performed using a sliding-window approach
Expand Down Expand Up @@ -960,7 +960,7 @@ split.data.by.time.or.bins = function(project.data, splitting.length, bins, spli
## get bins based on split.basis
dates = project.data$get.data.timestamps(split.basis)
dates = get.date.from.unix.timestamp(unname(unlist(dates)))
bins = split.get.bins.time.based(dates, splitting.length, number.windows)$bins
bins = split.get.bins.time.based(dates, splitting.length, number.windows)[["bins"]]
bins.labels = head(bins, -1)
## logging
logging::loginfo("Splitting data '%s' into time ranges of %s based on '%s' data.",
Expand Down

0 comments on commit 4b56d29

Please sign in to comment.