Description Usage Arguments Details Value Author(s)
uniqRowFreqs() identifies unique data.frame rows and counts how often each occurs.
1 | uniqRowFreqs(DF, simplify = TRUE)
|
DF |
A data.frame (or object that can be coerced into a data.frame) |
simplify |
Logical; if TRUE, return only UROWS data.frame, without UROW.ID column and UROW.FREQ column renames as "n.rows". |
Missing values are permitted, and missing (NA) will be treated as a single unique value when identifying unique combinations of the columns of DF.
Often one will only pass particular columns of a larger table, in order to count the unique combinations of just those columns.
If you try to apply this function to a data.frame that already contains columns names "UROW.ID" or "UFREQ.ID" (like from an early result of this function), you will get an error. To fix this, rename or remove those columns.
if simplify==TRUE, returns a data.frame, where the first column is called "n.rows" and the remaining columns have the same names as DF. All rows are unique, and n.rows contains the counts of occurrences of each row in DF.
if simplify==FALSE returns a list with two named elements:
UROWS A data.frame with the same format described above, but with an additional column UROW.ID prepended that holds an identifier for each unique row.
UROWIDs A vector with as many elements as rows in DF, mapping the rows in DF into the UROWS data.frame. This may be joined with the original DF using cbind()
M.W.Rowe, mwr.stats@gmail.com
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.