summarise_vals | R Documentation |
jj_summarize_sparse_mat calculates the sum or mean of values for each group in a sparse matrix. jj_summarize_vector summarizes a vector based on a group vector jj_summarize_dataframe summarizes each column in a data.frame based on a group vector
jj_summarize_sparse_mat(
summarize_obj,
summarize_by_vec,
method = "mean",
return_matrix = TRUE
)
jj_summarize_vector(
summarize_obj,
summarize_by_vec,
method = "mean",
order = T,
return_vec = F
)
jj_summarize_dataframe(summarize_obj, summarize_by_vec, method = "mean")
summarize_obj |
sparse matrix, vector, or data.frame |
summarize_by_vec |
vector with group annotation, has to have length equal to ncol(sparse_mat)/nrow(data.frame)/length(vector) |
method |
method used to summarize. Only mode available for non-numeric vectors, sum/mean for sparse matrix and mode/mean/median for numeric vectors |
return_matrix |
return as matrix instead of sparse matrix |
order |
order the summarized vector by the groups |
return_vec |
return only summarized vector instead of data.frame with summarized vector and groups |
df = data.frame(a=seq(1,5), b=c('a','b','b','b','a'), d=c(3,0,0,1,5))
jj_summarize_vector(df$d, df$b, method='mean')
jj_summarize_dataframe(df, df$b)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.