presencecount: Count appearence of variables and objects in a data.frame...

Description Usage Arguments Value Examples

Description

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.

Usage

1

Arguments

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

Value

sorted data.frame with amount of appearences for objacts or variables

Examples

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)

nevrome/varnastats documentation built on May 9, 2019, 10:43 a.m.