Row - Wise matrix/vector count the frequency of a value | R Documentation |
Row - Wise matrix/vector count the frequency of a value.
count_value(x, value)
colCountValues(x, values, parallel = FALSE,cores = 0)
rowCountValues(x, values, parallel = FALSE,cores = 0)
x |
A vector with the data (numeric or character) or a numeric matrix. |
value |
The value, numeric or character, to check its frequency in the vector "x". |
values |
a vector with the values to check its frequency in the matrix "x" by row or column. |
parallel |
Do you want to do it in parallel in C++? TRUE or FALSE. Works with every other argument. |
cores |
Number of cores to use for parallelism. Valid only when argument parallel is set to TRUE. Default value is 0 and it means the maximum supported cores. |
The functions is written in C++ in order to be as fast as possible. The "x" and "value" must have the same type. The type can be numeric or character.
The frequency of a value/values in a vector in linear time or by row/column in a matrix.
Manos Papadakis
R implementation and documentation: Manos Papadakis <papadakm95@gmail.com>.
Median, binary_search, Order, nth
x <- rnorm(100)
value <- x[50]
count_value(x,value)
y <- sample(letters,replace=TRUE)
value <- "r"
count_value(y,value)
values <- sample(x,100,replace=TRUE)
x <- matrix(x,100,100)
res<-colCountValues(x,values)
res<-rowCountValues(x,values)
x<-value<-values<-y<-NULL
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.