simsem / semTools

Useful tools for structural equation modeling
74 stars 36 forks source link

summary method of `FitDiff`: Can an argument added to allow users to disable the "dagger" symbol? #98

Closed sfcheung closed 3 years ago

sfcheung commented 3 years ago

The compareFit function is useful. However, the summary method uses a symbol that may not be displayed correctly on some environments:

https://github.com/simsem/semTools/blob/62dc7dffe35aa9eeb0b4272e9fd3ab2f78096c9e/semTools/R/compareFit.R#L151-L155

In my case, it is displayed as <U+2020>. This problem can be fixed by setting the locale. However, users may set the locale for a reason (e.g., to handle non-English characters in a data frame) and it is inconvenient to change the locale just for this function.

Alternatively, an argument may be added to allow user to specify the symbols to be used. However, this is optional. Just being able to turn this feature option is good enough.

My two cents.

TDJorgensen commented 3 years ago

Thanks for the suggestion. Try out the new tag= argument to the summary() method.

devtools::install_github("simsem/semTools/semTools")
# restart R
library(semTools)
class?FitDiff # read about new argument

I'm not sure how the locale issue works, but you should be able to pass any special character that R can interpret as a single character.

## unicode specifed with '\u' + 4-character code
'赢' == '\u8D62' # TRUE
nchar('\u8D62') # 1
summary(compareFit(...),
        tag = '\u8D62')

But you can also just set it to NULL or NA to omit the tags.