0

I am reasonably familiar with dplyr, but am stuck in the following issue. I have the following table.

Issue      Rejected Accepted

Issue 1    2        4
Issue 2    3        6
Issue 3    0        1

What I want to do is create a new column(Decision) which will have the accept and reject as the entries. So what I want to do is change it to the following,

Issue   Decision    Quantity

Issue 1 Rejected    2
Issue 1 Accepted    4
Issue 2 Rejected    3
Issue 2 Accepted    6
Issue 3 Rejected    0
Issue 3 Accepted    1
Psidom
  • 209,562
  • 33
  • 339
  • 356
Kulwant
  • 641
  • 2
  • 11
  • 28

1 Answers1

1
library(dplyr)
library(tidyr)
df1 <- gather(df, Issue)
colnames(df1)[2:3] <- c("Decision", "Quantity") 

df1 %>% arrange(Issue)
Sumedh
  • 4,835
  • 2
  • 17
  • 32