Description Usage Arguments Details Value See Also Examples
longString
returns the number of repeated values found sequentially within each row of a dataframe.
1 | longString(x, na.rm = FALSE, return.value = FALSE)
|
x |
An |
na.rm |
A logical scalar. Should missing values be removed? If |
return.value |
A logical scalar. Should the value of the longest string be returned? If
vector has no sequential repeats, this will return |
This function is designed to work with a dataframe or matrix object, and has two primary methods
of return: the number of the longest set of repetitions, or the value which those repititions
utilised. For example, if a respondent used option A 10 times in a row, return.values = FALSE
(default) would return 10, while return.values = TRUE
would return "A".
A vector of type integer, or type character if return.value = TRUE
and input is
a set of factors.
1 2 3 4 5 6 7 | ## Not run:
set.seed(77)
dat <- matrix(sample(1:3, 200, replace = TRUE),20,10)
longString(dat)
longString(dat, return.value = TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.