My code prints a tibble as binary matrix. It prints a binary matrix if a specific stringpart is matched (with grepl).
This is my output.
A tibble: 11 × 6
Aufzeichnungen `2010` `0070` Ä1 Ä5 `0010`
<chr> <chr> <chr> <chr> <chr> <chr>
1 Aufzeichnungen 0 0 0 0 0
2 07.03.22 A: stechender Schmerz, scharfkantig 0 0 0 0 0
3 D/B: 0 0 0 0 0
4 T: 0 0 0 0 0
5 pat aht an 36 üz distal, seit paartagen 1 0 0 1 0
6 36 vipr++, perk-, keine c zu entdekcne,üz bilfuird 1 1 0 0 0
7 pat aufgekläörtggf RÖ um c auszuschileßen, pat verweigert RÖ aus Angst vor Strahlung, pat 0 0 0 0 0
8 aufgeklärt angst nicht nötig und c unter fllg oder apprx nicht auszuschließen, 0 0 1 0 0
9 pat knirscht, schiene empohlen, pat meldet sich.. 0 0 0 0 0
10 next: noch schmerezn 0 0 0 0 0
11 an 36? 0 0 0 0 0
>
and from this point I want to generate as output a vector which gives me the column-names where column-sum > 0.
Like for this example (2010, 0070, Ä1, Ä5)
I tried it with a own function and colSums but here is the first column a problem, because its a character. I tought about to remove the first column for the process and add it for the context later, but maybe there is a simpler way to do this.
Thank you in advance.