either_both | R Documentation |
Takes two variables (or two vectors of variables) and returns a vector representing the 'or' or the 'and' of the combination of two variables and adds a custom suffix
either_both(
x,
y,
data = NULL,
either = TRUE,
pos = 1,
neg = 0,
addtn = "_comb",
usexnames = TRUE,
rmv = "none"
)
x |
quoted variable names (e.g. "var1") or vector of quoted variable names in the dataset to be compared to y |
y |
quoted variable names (e.g. "var1") or vector of quoted variable names in the dataset to be compared to x. If x and y are vectors of variable names they must be the same length |
data |
the dataset that contains the variables in x and y |
either |
boolean determining if the function should operate by 'or' or 'and'. default is TRUE indicating that the function returns the positive value if either input variable is 'positive'. FALSE returns positive if both input variables are positive |
pos |
the value that indicates 'positive', 'affirmative', or 'yes'. default is '1' to be used wit binary 0/1 variables |
neg |
the value that indicates 'negative', or 'no'. default is '0' to be used wit binary 0/1 variables |
addtn |
suffix to add to the variable names. default is '_comb' indicating 'combined'. if 'usexnames'==FALSE then addtn will be the base variable name and the iteration number will be added to it (e.g. if addtn is 'combined' then we would get combined1, combined2, etc.) |
usexnames |
boolean determining if the x variables should be used as the base variable names for the new combined variables. default is TRUE. if FALSE addtn is used as the base and then iterated if needed |
rmv |
text to remove from variable names if usexnames is TRUE. for example if all variable names contained '_pre_' and we wanted that removed we could put it in this argument. default is 'none' indicating no text is to be removed |
either_function()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.