get_stats_for_unique_values {usefun} | R Documentation |
Get stats for unique values
Description
Use this function on two vectors with same names
attribute (column
names), to find for each unique (numeric) value of the first vector, the
average and standard deviation values of the second vector's values (matching
is done by column name)
Usage
get_stats_for_unique_values(vec1, vec2)
Arguments
vec1 |
vector with |
vec2 |
vector with |
Value
A data.frame
consisting of 3 column vectors. The data.frame
size is nx3
, where n is the number of unique values of vec1
(rows).
The columns vectors are:
the first input vector pruned to its unique values
a vector with the average values for each unique value of the first vector (the matching is done by column name)
a vector with the standard deviation values for each unique value of the first vector (the matching is done by column name)
Examples
vec1 = c(1, 2, 3, 2)
vec2 = c(20, 2, 2.5, 8)
names.vec = c(seq(1,4))
names(vec1) = names.vec
names(vec2) = names.vec
res = get_stats_for_unique_values(vec1, vec2)
[Package usefun version 0.5.0 Index]