Description Usage Arguments Value Examples
A row or a column of a data.frame with numeric values is considered empty, if all
its values are 0. If objects or variables are present, their rows and columns contain
values != 0. To count the appearence of objects or variables, presencecount
counts
the amount of values != 0 within the rows or columns and writes them into a data.frame.
The result is sorted by the amount of appearences.
1 | presencecount(matrix, dim = 1)
|
matrix |
data.frame with numeric values |
dim |
switch to define if the appearences in columns (variables) or rows (objects) should be counted. 1: column (variables) appearences are counted 2: row (objects) appearences are counted |
sorted data.frame with amount of appearences for objacts or variables
1 2 3 4 5 | testmatrix <- data.frame(c1 = c(0,3,8,2), c2 = c(0,6,7,8), c3 = c(0,0,0,0))
rownames(testmatrix) <- c("r1","r2","r3","r4")
countvar <- presencecount(testmatrix, 1)
countobj <- presencecount(testmatrix, 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.