I'm very new person for R programming Language.help me to achieve my posted Question. Note: i need to achieve below task dynamically why because in future it will come more than 1000 column .
My Data Frame.
A_ID Queues COL1 COL2
1 First Z Z
1 First T Y
2 Second C C
1 Second A H
1 First B C
2 Second N F
2 Second I K
2 Second M A
3 First A Y
3 First P L
3 First L H
4 First R J
4 First U J
Data frame Dput data.
structure(list(A_ID = c(1, 1, 2, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4
), Queues = c("First", "First", "Second", "Second", "First",
"Second", "Second", "Second", "First", "First", "First", "First",
"First"), COL1 = c("Z", "T", "C", "A", "B", "N", "I", "M", "A",
"P", "L", "R", "U"), COL2 = c("Z", "Y", "C", "H", "C", "F", "K",
"A", "Y", "L", "H", "J", "J")), .Names = c("A_ID", "Queues",
"COL1", "COL2"), row.names = c(NA, -13L), class = "data.frame")
For Identification of changed and unchanged value.
A_ID Queues COL1 COL2 COL1Changedval COL2changedval
1 First Z Z 0 0
1 First T Y 1 1
1 First B C 1 1
1 Second A H 0 0
2 Second C C 0 0
2 Second N F 1 1
2 Second I K 1 1
2 Second M A 1 1
3 First A Y 0 0
3 First P L 1 1
3 First L H 1 1
4 First R J 0 0
4 First U J 1 0
Output data frame will be.
A_ID Queues COL1Changedval COL2changedval
1 First 2 2
1 Second 0 0
2 Second 3 3
3 First 2 2
4 First 1 0