1

I am trying to create a control chart using the code below but I am getting the error below. The data has the first Column as date then 12 other columns with different variables of data.

library("qcc")

attach(data)

Data_Frame_Data <- as.data.frame.matrix(data)


q <- qcc(Cancer_Activity
         , type="xbar"
         , nsigmas=3)

Error in sd.xbar(c(1396310400, 1398902400, 1401580800, 1404172800, 1406851200, : group sizes must be larger than one

This is the output when I run str(data)

Classes ‘tbl_df’, ‘tbl’ and 'data.frame':   48 obs. of  13 variables:
 $ Date         : POSIXct, format: "2014-04-01" "2014-05-01" "2014-06-01" "2014-07-01" ...
 $ CW_Activity  : num  37 29.5 34 46 39.5 41.5 42 40 46 39.5 ...
 $ CW_Breach    : num  3.5 6 8.5 10 5.5 8 4.5 3 3.5 4 ...
 $ ICHT_Activity: num  73.5 89 60 83.5 85 88.5 65.5 80 75.5 74 ...
 $ ICHT_Breach  : num  8 11.5 11.5 12 11 15 9.5 14 8.5 16.5 ...
 $ LNWH_Activity: num  67 76.5 56 79.5 67 83 77.5 67 66 60.5 ...
 $ LNWH_Breach  : num  10 12.5 13 14 10.5 16 16.5 12 5 13.5 ...
 $ THH_Activity : num  30 26 24.5 36 31 25 33 21.5 42 25.5 ...
 $ THH_Breach   : num  2 3 2 1 5 1.5 3.5 0.5 3.5 3 ...
 $ RBH_Activity : num  2.5 5 6.5 7 6.5 7.5 3.5 9 8 6.5 ...
 $ RBH_Breach   : num  0.5 1 2 2 4 4 1 2 2.5 2 ...
 $ NWL_Activity : num  210 226 181 252 229 ...
 $ NWL_Breach   : num  24 34 37 39 36 44.5 35 31.5 23 39 ...
10
  • Thanks, I have just added it in. Commented Nov 1, 2017 at 12:14
  • Yes, I get the same error message. Commented Nov 1, 2017 at 13:53
  • When I change the data for the data for the data frame that I have created I get this error message : Error in data.matrix(data) : (list) object cannot be coerced to type 'double' Commented Nov 1, 2017 at 14:00
  • Please, start a new R session and run this code: pastebin.com/myB64q89 Let me know what you get. Commented Nov 1, 2017 at 14:28
  • This has worked! Is there any way of having the dates on the x axis? And how do you specify which column you want to use? Commented Nov 1, 2017 at 14:34

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.