I'm working on r. I would like to ask for help converting my df into a different df1 to work with it: The current df look like this:
|--------|----|-----------|-----------|-----------|
| Entity | ID | Category1 | Category2 | Category3 |
|--------|----|-----------|-----------|-----------|
| AB | 01 | 00 | 01 | 01 |
| AC | 02 | 00 | 01 | 00 |
|--------|----|-----------|-----------|-----------|
I need to convert it in something like this:
Entity ID Categories Value
AB 01 Category1 00
AB 01 Category2 01
AB 01 Category3 01
AC 02 Category1 00
AC 02 Category2 01
AC 02 Category3 00
The transposing function does not help because as you can see I need the categories to be copied vertically one after the other. I really need help with this as my df is extremely big to do it manually, and I would highly appreciate your help R community. Please!!
Data in dput
format
data <-
structure(list(Entity = c("AB", "AC"), ID = c(1, 2), Category1 = c(0,
0), Category2 = c(1, 1), Category3 = c(1, 0)), row.names = c(NA,
-2L), class = "data.frame")