I want to convert the R data frame column names to rows by looking at conditions like,
- If two column names are having partial common name separated by '_' like x_a01, y_a01 convert it to 1 row item with common name as a01 based on date. Ex: x_a01, y_a01 -> a01, x_b01, y_b01 -> b01
- These converted column names to row values should have non zero values. Ex: x_c01, y_c01 have 0 values in 1st row these should be ignored while converting to row items
The dataframe:
Convert the above dataframe to: