Skip to content

Help with unwieldly table #1370

Answered by kubu4
kubu4 asked this question in Q&A
Jan 25, 2022 · 3 comments · 8 replies
Discussion options

You must be logged in to vote

Guess I should've just gone to StackOverflow right away. Posted my problem and received a solution in R in less than 5 minutes (seriously).

Here's the solution, which is based off of the example table I posted above:

library(dplyr)
desired_result = your_data %>%
  group_by(name_of_first_column) %>%
  summarize(across(everything(), ~sum(. > 0)))

I'll have to figure out some usage of select() to get the full input table and I'll have to figure out a way to programmatically rename all the columns in the output data, but that seems much more feasible for my skillset.

Replies: 3 comments 8 replies

Comment options

You must be logged in to vote
2 replies
@kubu4
Comment options

kubu4 Jan 25, 2022
Maintainer Author

@kubu4
Comment options

kubu4 Jan 25, 2022
Maintainer Author

Comment options

kubu4
Jan 25, 2022
Maintainer Author

You must be logged in to vote
4 replies
@kubu4
Comment options

kubu4 Jan 26, 2022
Maintainer Author

@kubu4
Comment options

kubu4 Jan 26, 2022
Maintainer Author

@kubu4
Comment options

kubu4 Jan 26, 2022
Maintainer Author

@kubu4
Comment options

kubu4 Jan 26, 2022
Maintainer Author

Comment options

kubu4
Jan 27, 2022
Maintainer Author

You must be logged in to vote
2 replies
@kubu4
Comment options

kubu4 Jan 27, 2022
Maintainer Author

@kubu4
Comment options

kubu4 Jan 27, 2022
Maintainer Author

Answer selected by kubu4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants