Skip to content

Commit

Permalink
small bug fix in extraction funs
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasjclark committed Aug 31, 2023
1 parent c37b2dc commit 6de7a16
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions R/as.data.frame.mvgam.R
Original file line number Diff line number Diff line change
Expand Up @@ -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'){
Expand Down Expand Up @@ -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'){
Expand Down Expand Up @@ -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')))])
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions R/index-mvgam.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6de7a16

Please sign in to comment.