Skip to content

Commit d41b2b1

Browse files
bug fix
1 parent ec7d04b commit d41b2b1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

R/flow_frame.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ mp_state_vars = function(spec, topological_sort = FALSE, loops = "^$", trans = "
195195
states = vapply(spec$change_model$update_state(), lhs_char, character(1L))
196196
flows = mp_flow_frame(spec, topological_sort = FALSE)
197197
if (topological_sort) states = topological_sort_general(flows, loops, states)
198-
return(sprintf("%s_%s", trans, states))
198+
if (nchar(trans) > 0) states = sprintf("%s_%s", trans, states)
199+
return(states)
199200
}
200201

201202
#' @describeIn mp_vars Return the names of all variables that contain
@@ -209,7 +210,8 @@ mp_flow_vars = function(spec, topological_sort = FALSE, loops = "^$", trans = ""
209210
} else {
210211
flow_vars = spec$change_model$flow_frame()$change
211212
}
212-
unique(sprintf("%s_%s", trans, flow_vars))
213+
if (nchar(trans) > 0) flow_vars = sprintf("%s_%s", trans, flow_vars)
214+
return(flow_vars)
213215
}
214216

215217
#' @describeIn mp_vars Union of `mp_state_vars()` and `mp_flow_vars()`.

0 commit comments

Comments
 (0)