Description Usage Arguments Details Value Examples

View source: R/transform_gate-methods.R

Shift a Gate-type filter object in one or more dimensions

1 2 | ```
## Default S3 method:
shift_gate(obj, dx = NULL, dy = NULL, center = NULL, ...)
``` |

`obj` |
A Gate-type |

`dx` |
Either a numeric scalar or numeric vector. If it is scalar, this is just the desired shift of the gate in
its first dimension. If it is a vector, it specifies both |

`dy` |
A numeric scalar specifying the desired shift of the gate in its second dimension. |

`center` |
A numeric vector specifying where the center or centroid should be moved (rather than specifiying |

`...` |
Additional arguments not used |

This method allows for geometric translation of filter types defined by simple geometric gates
(`rectangleGate`

, `quadGate`

, `ellipsoidGate`

, or `polygonGate`

).
The method provides two approaches to specify a translation. For `rectangleGate`

objects, this will
shift the `min`

and `max`

bounds by the same amount in each specified dimension. For `quadGate`

objects, this will simply shift the divinding boundary in each dimension. For `ellipsoidGate`

objects, this
will shift the center (and therefore all points of the ellipse). For `polgonGate`

objects, this will simply
shift all of the points defining the polygon.

The method allows two different approaches to shifting a gate. Through the `dx`

and/or `dy`

arguments,
a direct shift in each dimension can be provided. Alternatively, through the `center`

argument, the gate
can be directly moved to a new location in relation to the old center of the gate. For `quadGate`

objects,
this center is the intersection of the two dividing boundaries (so the value of the `boundary`

slot). For
`rectangleGate`

objects, this is the center of the rectangle defined by the intersections of the centers
of each interval. For `ellipsoidGate`

objects, it is the center of the ellipsoid, given by the `mean`

slot. For `polygonGate`

objects, the centroid of the old polygon will be calculated and shifted to the new
location provided by `center`

and all other points on the polygon will be shifted by relation to the centroid.

A Gate-type `filter`

object of the same type as `gate`

, with the translation applied

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
## Not run:
# Moves the entire gate +500 in its first dimension and 0 in its second dimension
shifted_gate <- shift_gate(original_gate, dx = 500)
#Moves the entire gate +250 in its first dimension and +700 in its second dimension
shifted_gate <- shift_gate(original_gate, dx = 500, dy = 700)
# Same as previous
shifted_gate <- shift_gate(original_gate, c(500,700))
# Move the gate based on shifting its center to (700, 1000)
shifted_gate <- shift_gate(original_gate, center = c(700, 1000))
## End(Not run)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.