Skip to content

Commit

Permalink
Fixes test warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
vwmaus committed Sep 7, 2023
1 parent 6329150 commit 80e6df9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions R/plot_patterns.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
plot.knn1_twdtw <- function(x, n = 12, ...) {

# Convert the list of time series data into a long-format data.frame
df <- unnest(x$data[1:n, ], cols = .data$observations)
df <- unnest(x$data[1:n, ], cols = 'observations')

# Melt the data into long format suitable for ggplot2
df <- pivot_longer(df, !c(.data$label, .data$time), names_to = "band", values_to = "value")
df <- pivot_longer(df, !c('label', 'time'), names_to = "band", values_to = "value")

# Construct the ggplot
gp <- ggplot(df, aes(x = .data$time, y = .data$value, colour = .data$band)) +
gp <- ggplot(df, aes(x = 'time', y = 'value', colour = 'band')) +
geom_line() +
facet_wrap(~label) +
facet_wrap(~'label') +
theme(legend.position = "bottom") +
guides(colour = guide_legend(title = "Bands")) +
ylab("Value") +
Expand Down
2 changes: 1 addition & 1 deletion R/prepare_time_series.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ prepare_time_series <- function(x) {
x$band <- rep(date_band$band, ns)
x$time <- rep(date_band$time, ns)
x$band_date <- NULL
result_df <- pivot_wider(x, id_cols = c(.data$ts_id, .data$label, .data$time), names_from = 'band', values_from = 'value')
result_df <- pivot_wider(x, id_cols = c('ts_id', 'label', 'time'), names_from = 'band', values_from = 'value')
result_df <- nest(result_df, .by = c(.data$ts_id, .data$label), .key = "observations")

return(result_df)
Expand Down
2 changes: 1 addition & 1 deletion R/train.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ knn1_twdtw <- function(x, y, formula = NULL, start_column = 'start_date',
ts_data$observations <- lapply(ts_data$observations, shift_ts_dates)

# Split data frame by label
ts_data <- unnest(ts_data, cols = .data$observations)
ts_data <- unnest(ts_data, cols = 'observations')
ts_data <- nest(ts_data, .by = .data$label, .key = "observations")

# Define GAM function
Expand Down

0 comments on commit 80e6df9

Please sign in to comment.