qccGroups.Rd
This function allows to easily group data to use as input to the qcc()
function.
qccGroups(data, x, sample)
a data frame (or a similar structure which can be coerced to be a data.frame
) providing the observed data. If not provided, the input to the following arguments must be objects defined in the calling environment.
a name from data
or a vector of observed data values.
a name from data
or a vector of sample indicators defining the rationale subgroups of data values.
The function returns a matrix of suitable dimensions. If one or more group have fewer observations than others, NA
values are used to fill empty values.
data(pistonrings)
# create a matrix of 40 samples made of 5 observations each
qccGroups(data = pistonrings, diameter, sample)
#> [,1] [,2] [,3] [,4] [,5]
#> 1 74.030 74.002 74.019 73.992 74.008
#> 2 73.995 73.992 74.001 74.011 74.004
#> 3 73.988 74.024 74.021 74.005 74.002
#> 4 74.002 73.996 73.993 74.015 74.009
#> 5 73.992 74.007 74.015 73.989 74.014
#> 6 74.009 73.994 73.997 73.985 73.993
#> 7 73.995 74.006 73.994 74.000 74.005
#> 8 73.985 74.003 73.993 74.015 73.988
#> 9 74.008 73.995 74.009 74.005 74.004
#> 10 73.998 74.000 73.990 74.007 73.995
#> 11 73.994 73.998 73.994 73.995 73.990
#> 12 74.004 74.000 74.007 74.000 73.996
#> 13 73.983 74.002 73.998 73.997 74.012
#> 14 74.006 73.967 73.994 74.000 73.984
#> 15 74.012 74.014 73.998 73.999 74.007
#> 16 74.000 73.984 74.005 73.998 73.996
#> 17 73.994 74.012 73.986 74.005 74.007
#> 18 74.006 74.010 74.018 74.003 74.000
#> 19 73.984 74.002 74.003 74.005 73.997
#> 20 74.000 74.010 74.013 74.020 74.003
#> 21 73.988 74.001 74.009 74.005 73.996
#> 22 74.004 73.999 73.990 74.006 74.009
#> 23 74.010 73.989 73.990 74.009 74.014
#> 24 74.015 74.008 73.993 74.000 74.010
#> 25 73.982 73.984 73.995 74.017 74.013
#> 26 74.012 74.015 74.030 73.986 74.000
#> 27 73.995 74.010 73.990 74.015 74.001
#> 28 73.987 73.999 73.985 74.000 73.990
#> 29 74.008 74.010 74.003 73.991 74.006
#> 30 74.003 74.000 74.001 73.986 73.997
#> 31 73.994 74.003 74.015 74.020 74.004
#> 32 74.008 74.002 74.018 73.995 74.005
#> 33 74.001 74.004 73.990 73.996 73.998
#> 34 74.015 74.000 74.016 74.025 74.000
#> 35 74.030 74.005 74.000 74.016 74.012
#> 36 74.001 73.990 73.995 74.010 74.024
#> 37 74.015 74.020 74.024 74.005 74.019
#> 38 74.035 74.010 74.012 74.015 74.026
#> 39 74.017 74.013 74.036 74.025 74.026
#> 40 74.010 74.005 74.029 74.000 74.020
# remove some observations to get still a 40x5 matrix but filled with NAs
qccGroups(data = pistonrings[-c(1,2,50,52,199),], diameter, sample)
#> [,1] [,2] [,3] [,4] [,5]
#> 1 74.019 73.992 74.008 NA NA
#> 2 73.995 73.992 74.001 74.011 74.004
#> 3 73.988 74.024 74.021 74.005 74.002
#> 4 74.002 73.996 73.993 74.015 74.009
#> 5 73.992 74.007 74.015 73.989 74.014
#> 6 74.009 73.994 73.997 73.985 73.993
#> 7 73.995 74.006 73.994 74.000 74.005
#> 8 73.985 74.003 73.993 74.015 73.988
#> 9 74.008 73.995 74.009 74.005 74.004
#> 10 73.998 74.000 73.990 74.007 NA
#> 11 73.994 73.994 73.995 73.990 NA
#> 12 74.004 74.000 74.007 74.000 73.996
#> 13 73.983 74.002 73.998 73.997 74.012
#> 14 74.006 73.967 73.994 74.000 73.984
#> 15 74.012 74.014 73.998 73.999 74.007
#> 16 74.000 73.984 74.005 73.998 73.996
#> 17 73.994 74.012 73.986 74.005 74.007
#> 18 74.006 74.010 74.018 74.003 74.000
#> 19 73.984 74.002 74.003 74.005 73.997
#> 20 74.000 74.010 74.013 74.020 74.003
#> 21 73.988 74.001 74.009 74.005 73.996
#> 22 74.004 73.999 73.990 74.006 74.009
#> 23 74.010 73.989 73.990 74.009 74.014
#> 24 74.015 74.008 73.993 74.000 74.010
#> 25 73.982 73.984 73.995 74.017 74.013
#> 26 74.012 74.015 74.030 73.986 74.000
#> 27 73.995 74.010 73.990 74.015 74.001
#> 28 73.987 73.999 73.985 74.000 73.990
#> 29 74.008 74.010 74.003 73.991 74.006
#> 30 74.003 74.000 74.001 73.986 73.997
#> 31 73.994 74.003 74.015 74.020 74.004
#> 32 74.008 74.002 74.018 73.995 74.005
#> 33 74.001 74.004 73.990 73.996 73.998
#> 34 74.015 74.000 74.016 74.025 74.000
#> 35 74.030 74.005 74.000 74.016 74.012
#> 36 74.001 73.990 73.995 74.010 74.024
#> 37 74.015 74.020 74.024 74.005 74.019
#> 38 74.035 74.010 74.012 74.015 74.026
#> 39 74.017 74.013 74.036 74.025 74.026
#> 40 74.010 74.005 74.029 74.020 NA