simplerspec icon indicating copy to clipboard operation
simplerspec copied to clipboard

In plot_spc, is slicing really needed?

Open tag-dad opened this issue 2 years ago • 7 comments

Dear Philipp :-)

I found that dplyr::slice() sometimes returns an empty dataframe and then an empty plot from the plot_spc() function. So I checked the slice() function using the famous dataset, "mtcars" on several PCs. It works as intended on some PCs but it yields an empty dataframe on some others. I am still trying to figure out what causes the issue and my first guess is that this seems to happen when the PC has the settings in Korean.

Anyways I wonder if slicing spc_tbl by row index is really needed in plot_spc().

Thanks!

tag-dad avatar Jul 25 '23 15:07 tag-dad

Hey Juhwan, ooh thanks for reporting. I will check this one and come back to you. Thanks :-)

philipp-baumann avatar Aug 29 '23 05:08 philipp-baumann

have you checked out plot_spc_ext()?

philipp-baumann avatar Aug 29 '23 05:08 philipp-baumann

hmm it might be locale related. What encoding are you using @tag-dad ? Guess you are on Win. What is your R version? It could be that slicing depends on grouping, which relies on character encoding working correctly.

philipp-baumann avatar Aug 29 '23 06:08 philipp-baumann

Hi Philipp,

R version is 4.3.1. And below is the locale of R that I am running on: "LC_COLLATE=English_United States.utf8;LC_CTYPE=English_United States.utf8;LC_MONETARY=English_United States.utf8;LC_NUMERIC=C;LC_TIME=English_United States.utf8"

I thought it might be locale related as well but now not so sure. If I set slice = F, then spc_plot() works just fine as in the function, the line reads if (slice == TRUE) { spc_tbl <- dplyr::slice(spc_tbl) }.

Anyhows, I will be checking plot_spc_ext(). ;-) Thanks!

tag-dad avatar Aug 30 '23 05:08 tag-dad

Hi Philipp,

R version is 4.3.1. And below is the locale of R that I am running on: "LC_COLLATE=English_United States.utf8;LC_CTYPE=English_United States.utf8;LC_MONETARY=English_United States.utf8;LC_NUMERIC=C;LC_TIME=English_United States.utf8"

I thought it might be locale related as well but now not so sure. If I set slice = F, then spc_plot() works just fine as in the function, the line reads if (slice == TRUE) { spc_tbl <- dplyr::slice(spc_tbl) }.

Anyhows, I will be checking plot_spc_ext(). ;-) Thanks!

Hey Juhwan, yeah then it seems not related directly to locale I guess ;-) but plot_spc_ext() is anyhow the better choice. If anything does not work as expected, just ping me here or via mail. Cheers

philipp-baumann avatar Aug 30 '23 13:08 philipp-baumann

@tag-dad I will keep this bug open. Once I have time I will try to reproduce the error. Cheers

philipp-baumann avatar Aug 31 '23 10:08 philipp-baumann

yeah you are prob. right. Can you do slice = FALSE to omit the issue?

philipp-baumann avatar Aug 31 '23 10:08 philipp-baumann