Closed hjdruc closed 1 year ago
@hjdruc Thank you very much. We will look into this and will incorporate necessary changes in our next update. Thank you very much. We really appreciate it.
This should be fixed in the latest version of the se_comparison
branch 👍
Thanks for the amazing panelmatch package.
When I set moderator <- var.name, sometimes I got the error message: Error in names(ret.obj) <- as.character(as.vector(na.omit(moderating.values))): 'names' attribute [4] must be the same length as the vector [3]
Finally I found the reason is: In fuction "handle_moderating_variable" which is in "PanelMatch\R\PE_lower_level.R", although moderator has 4 value (by: moderating.values <- unique(ordered.data[, moderator]), the actual number of ret.obj is only 3 (induced by: moderated.sets.att[[make.names(val)]] <- NULL). Thus, when ret.obj (the length is 3) was set attribute name (the lenth is 4), the errror occured.
Currently, I fix this error by (still in fuction "handle_moderating_variable"): ... valid.moderating.values.vector <- c() # a vector to replace moderating.values for(val in as.vector(na.omit(moderating.values))) {
make sure we handle empty set situation
...
use valid value as vector
names(ret.obj) <- as.character(as.vector(valid.moderating.values.vector))
return(ret.obj)
By this way, I can deal with the problem in my own case. If this is the right way, how about fix it in a better and formal way when launch the next Panelmatch version?
Thanks for your excellent and hard work.