get_stats_for_unique_values | R Documentation |
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)
get_stats_for_unique_values(vec1, vec2)
vec1 |
vector with |
vec2 |
vector with |
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)
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.