How to Reverse a string in R

后端 未结 14 2050
花落未央
花落未央 2020-11-27 03:29

I\'m trying to teach myself R and in doing some sample problems I came across the need to reverse a string.

Here\'s what I\'ve tried so far but the paste operation d

14条回答
  •  攒了一身酷
    2020-11-27 03:59

    You can also use the IRanges package.

    library(IRanges)
    x <- "ATGCSDS"
    reverse(x)
    # [1] "SDSCGTA"
    

    You can also use the Biostrings package.

    library(Biostrings)
    x <- "ATGCSDS"
    reverse(x)
    # [1] "SDSCGTA"
    

提交回复
热议问题