Skip to content

Improving ranktransform(sign = TRUE) #570

@mattansb

Description

@mattansb

Currently, if x contains 0s, these are marked as NAs.

However, there might be situations where this is unwanted (see easystats/effectsize#502).

We can add a zeros= argument, that can take the values:

  • "na" - the current method.
  • "signrank" - keep them during the ranking and mark them as 0.
if (zeros == "na") {
  out <- rep(NA, length(x))
  ZEROES <- x == 0
  out[!ZEROES] <- sign(x[!ZEROES]) * rank(abs(x[!ZEROES]), 
                                          ties.method = method,
                                          na.last = "keep")
} else if (zeros == "signrank") {
  out <- sign(x) * rank(abs(x), ties.method = method, na.last = "keep")
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions