Description Usage Arguments Details Value Examples
View source: R/data_preparation_functions.R
Iteratively removes all rows and columns of a matrix or dataframe with less than a given number of non zero elements
1 |
x |
matrix or data.frame. Table with only numeric values. |
minnumber |
integer. A number of minimum non zero elements. How many values > 0 have to be
present to consider a row/column sufficiently linked to perform further analysis?
Every column with less values > 0 will be removed. Either |
cmin |
integer. Same as |
rmin |
integer. Same as |
A matrix or data.frame with numeric values often contains rows and columns with an insufficient amount of values > 0 for a certain task. For example correspondence analysis or bivariate correlation analysis requires a minimum amount of usable values. In an archaeological context this could apply for example, if certain find categories are particularly rare in a burial site context.
delrc
allows to remove rows and columns, that don't fulfill the requirements.
A matrix or dataframe with all rows and columns removed that had less than
the given number of non zero elements. If minnumber
or cmin
and
rmin
are too restrictive and no content remains in the table, than the result is
NA
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | testmatrix <- data.frame(
c1 = c(0,3,8,2),
c2 = c(0,6,7,0),
c3 = c(0,0,0,0),
c4 = c(0,3,8,2),
c5 = c(0,6,7,0),
c6 = c(1,0,0,1)
)
# The following code removes every column with less than 3 values > 0.
# That will remove the columns c2, c3, c5 and c6.
# Further, every row with less than 2 values gets removed.
# That will delete row 1.
itremove(testmatrix, cmin = 3, rmin = 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.