0

I need help in rearranging my data set from right to left in R. This is the original dataset:

Sorry for the confusion, but they are not string. It is a dataset like:

Column_a, Column_b, Column_c, Column_d, Column_e, Column_f, Column_g

A           A          B         B          C

A           B          A         C

A           C          B         A          C        B          B

Using rev function, i get this:

Column_a, Column_b, Column_c, Column_d, Column_e, Column_f, Column_g

                   C         B          B       A          A

                             C          A       B          A

B B C A B C A

But how to get rid of those blank/NA cells?

The Ideal output looks like this:

Column_a, Column_b, Column_c, Column_d, Column_e, Column_f, Column_g

C B B A A

C A B A

B B C A B C A

Thanks!

Alina HE
  • 31
  • 1
  • 5
  • 2
    Check out `stri_reverse` in the [`stringi`](https://cran.r-project.org/web/packages/stringi/index.html) package. – Dan Aug 24 '17 at 14:21
  • sorry for the confusion. They are not string, but a data set. Each letter is in a separate cell. So AABBC is one observation with five columns. Thanks. – Alina HE Aug 24 '17 at 14:32

0 Answers0