1

Two questions:

  1. I like to store and process the output of ss.study.ca() in same way as I do with ggplot:

    p1 <- ggplot(..) + ...
    p2 <- ss.study.ca(....)
    multiplot(p1, p2, rows = 2)         # this function puts 2 graphs on 1 page           
    

    However p2 seems to want a page for its own.

  2. Second questions is that ss.study.ca() returns both a NULL and a warning message like:

    1: In ss.study.ca(df_temp$Value, LSL = (df_temp$LimitLo)[1], USL = (df_temp$LimitHi)[1], : Normality test/s failed

    As I use ss.study.ca in a loop I like to suppress both messages.

Any pointer for solution is appreciated.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Lucky
  • 29
  • 3
  • It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Apr 13 '20 at 06:44
  • thanks Emilio. The suppressWarninings() call solved the issue. – Lucky Apr 29 '20 at 09:36

2 Answers2

0

Thank you for your questions Luc.

  1. ss.study.ca() does not produce a ggplot but a grid plot (with ggplots inside). Nonetheless, as ggplot internally also uses the grid system, you can merge SixSigma and ggplot2 plots with the grid and gridExtra packages. This is a reproducible example that works for me:
    library(SixSigma)
    library(gridExtra)
    library(grid)
    library(ggplot2)
    grid.arrange(grid.grabExpr(
      ss.study.ca(ss.data.ca$Volume, rnorm(40, 753, 3), 
                  LSL = 740, USL = 760, T = 750, alpha = 0.05, 
                  f.sub = "Winery Project")),
      ggplot(data.frame(x=rnorm(100)), aes(x)) + geom_histogram()
    )
  1. You can suppress the warnings within a loop enclosing your expressions within the suppressWarnings functions. This a simple example, there could be more expressions:
    suppressWarnings({
      ss.study.ca(rexp(40, 0.01),
                  LSL = 740, USL = 760, T = 750, alpha = 0.05, 
                  f.sub = "Winery Project")
    })

I am not sure about the NULL message, if it is not fixed with the suppressWarnings funcion, maybe a reprex would help.

ELCano
  • 156
  • 4
0

Thanks for your respose. The suppressWarnings() call indeed removes both the warning and the NULL.

While I confirm the provided example grid.arrange((....)) works, in my code, where only the ggplot(), differs I get below error mesage:

Error in grabDL(warn, wrap, wrap.grobs, ...) : 
  'list' object cannot be coerced to type 'double'

Is this caused by the content of ggplot()?

Lucky
  • 29
  • 3
  • I don't think so, as the error is in `grabDL`, and I assume it has to do with the output of `ss.study.ca`. Try to grid.arrange your ggplot twice, and see If it works. If not, it is the ggplot. If yes, maybe you could share your code to check. PS: could you please mark the previous answer as useful, as the warnings issue was fixed? – ELCano Apr 23 '20 at 17:47