Skip to content

Avoiding as.rsi() changing D to I automatically #80

Answered by msberends
send2dan asked this question in Q&A
Discussion options

You must be logged in to vote

Ah, tell me about it! Old lab systems are a pain!

But right, then it would be quite hard to work with D in the AMR package.

I even tried doing this for you:

my_own_rsi <- function(x, include_these = c("S", "I", "D", "R")) {
  structure(
    factor(x, levels = include_these, ordered = TRUE),
    class = c("rsi", "factor")
  )
}

And then tried whether it could be used to determine resistance, but it doesn't:

x <- my_own_rsi(c(rep("S", 100), rep("D", 100), rep("R", 100)))
# this seems to work:
x
#> Class 'rsi'
#>   [1] S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S
#>  [73] S S S S S S S S S S S …

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by send2dan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants