From 6de7a1658bd7e304b86db5984b63960b8eee3713 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Thu, 31 Aug 2023 16:52:49 +1000 Subject: [PATCH] small bug fix in extraction funs --- R/as.data.frame.mvgam.R | 8 ++++---- R/index-mvgam.R | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/R/as.data.frame.mvgam.R b/R/as.data.frame.mvgam.R index 2b709bdc..263d7c9a 100644 --- a/R/as.data.frame.mvgam.R +++ b/R/as.data.frame.mvgam.R @@ -369,7 +369,7 @@ validate_variables = function(x, variable, regex = FALSE){ call. = FALSE) } to_extract <- 'rho' - newnames <- x$sp_names + newnames <- paste0(x$sp_names, '_rho') } if(variable[1] == 'linpreds'){ @@ -412,7 +412,7 @@ validate_variables = function(x, variable, regex = FALSE){ to_extract <- 'rho_trend' newnames <- paste0(unlist(purrr::map(x$trend_mgcv_model$smooth, - 'label')), '_trend') + 'label')), '_rho_trend') } if(variable[1] == 'trend_linpreds'){ @@ -453,8 +453,8 @@ validate_variables = function(x, variable, regex = FALSE){ vars_to_extract[[i]] <- unname(unlist(purrr::map(all_vars, 'orig_name'))[ grepl(variable[i], unlist(purrr::map(all_vars, 'orig_name')))]) - names_to_use[[i]] <- unname(unlist(purrr::map(all_vars, 'orig_name'))[ - grepl(variable[i], unlist(purrr::map(all_vars, 'alias')))]) + names_to_use[[i]] <- unname(unlist(purrr::map(all_vars, 'alias'))[ + grepl(variable[i], unlist(purrr::map(all_vars, 'orig_name')))]) } } } diff --git a/R/index-mvgam.R b/R/index-mvgam.R index b10cf277..2132aa7a 100644 --- a/R/index-mvgam.R +++ b/R/index-mvgam.R @@ -136,14 +136,14 @@ variables.mvgam = function(x, ...){ if(any(grepl(paste(c('sigma', 'alpha_gp', 'rho_gp', 'ar1', 'ar2', - 'ar3', '//bA//b', + 'ar3', 'A', 'Sigma'), collapse = '|'), parnames) & !grepl('sigma_obs', parnames, fixed = TRUE))){ trend_pars <- grepl(paste(c('sigma', 'alpha_gp', 'rho_gp', 'ar1', 'ar2', - 'ar3', '//bA//b', + 'ar3', 'A', 'Sigma'), collapse = '|'), parnames) & !grepl('sigma_obs', parnames, fixed = TRUE)