rsm (version 2.10.2)

djoin: Join designs together into a blocked design


This implements the rsm package's building-block provisions for handling sequences of experiments. We often want to join two or more designs into one blocked design for purposes of analysis.


djoin(design1, design2, …, blkname = "Block", blocklev)



A object (must have been created by rsm 2.00 or higher).


A data.frame (or to be appended; or a call to a function that will create a design

Additional designs to be appended


Name to give to the blocking variable that distinguishes the designs that are joined


Label to use in the blocking variable for the added design


A object to be displayed.


djoin returns a object with the combined designs, and coding formulas from the last object added. The generated blocking variable will be a factor. The designs are sorted by blocks and run.order within blocks; and its row.names will be integers corresponding to this ordering.

The function stdorder sorts such data by block and std.order within block to display the designs in their pre-randomized order.


djoin may be used to augment a design with all manner of other designs, including regular designs generated by cube and its relatives, data.frames, and other objects. The underlying paradigm is that each design joined is a separate block, and the order in which they are joined could matter.

It tries to do this in a smart way: The first design, design1, is required to be a object. If design2 is a data.frame, and variables with the coded names are not present, it is automatically coded according to design1's coding formulas. If design2 is a object, and its coding formulas differ from those of design1, then design1 is recoded with design2's codings before the designs are joined. In both cases, any variables in design2 not matched in design1 are excluded, and any design1 variables absent in design2 are added with values of NA.

See Also

cube,, bbd


# Some existing data
CR1 <-, x1 ~ (Time - 85)/5, x2 ~ (Temp - 175)/5)
# add the second part of the experiment; it gets coded automagically
djoin(CR1, ChemReact2)

# A new experiment in a different part of the design space
newdes <- cube(Yield ~ x1 + x2,  n0 = 3, 
    coding = c(x1 ~ (Time - 70)/10, x2 ~ (Temp - 180)/5))
# Time passes ... we do the experiment and plug-in the observed Yield values
newdes$Yield <- rnorm(7, 75, 3) # these are our pretend results
combined <- djoin(CR1, newdes)
# Observe that the combined dataset is recoded to the new formulas
print(combined, decode = FALSE)

# List the new design in standard order
# }