max_rank | R Documentation |
like rank() with ties.method = "max", works on tbl objects
max_rank(df, col, col_new)
df |
dataframe |
col |
character column name to rank y |
col_new |
character column name for rankings |
this is needed for hochberg p value adjustment. We need to assign higher rank when multiple sites have same p value
df <- tibble::tibble(s = c(1, 2, 2, 2, 5, 10)) %>%
dplyr::mutate(
rank = rank(s, ties.method = "max")
)
df %>%
max_rank("s", "max_rank")
# Database
con <- DBI::dbConnect(duckdb::duckdb(), dbdir = ":memory:")
dplyr::copy_to(con, df, "df")
max_rank(dplyr::tbl(con, "df"), "s", "max_rank")
DBI::dbDisconnect(con)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.