row-oriented-workflows | Row-oriented workflows in R with the tidyverse
kandi X-RAY | row-oriented-workflows Summary
kandi X-RAY | row-oriented-workflows Summary
Row-oriented workflows in R with the tidyverse
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of row-oriented-workflows
row-oriented-workflows Key Features
row-oriented-workflows Examples and Code Snippets
Community Discussions
Trending Discussions on row-oriented-workflows
QUESTION
How do I apply a function to many columns of grouped rows? For example;
...ANSWER
Answered 2018-Oct-31 at 08:00Here's my solution. This problem is not really a purrr
task, because there is nothing really that you want to map a single function to. Instead, what I understand the problem to be is that you want to match each X
value in a Bounce
row with the corresponding Smooth
row X
values of the same Date
and Seq1
(and there is only one such row). This means that it is really a merging or joining problem, and then the approach is to set up the join so that you can match the right values and do the sum. So I go as follows:
- Split the data into the
Smooth
rows and theBounce
rows andgather
so that all theX
values are in one column - Join the
smooths
onto thebounces
with aleft_join
, so each originalBounce
row now has its correspondingSmooth
. mutate
the sum into a new column and select/rename the columns to be as in the originalbind_rows
to join the newly summedbounces
andspread
to return to the original layout.
This should be robust to any number of Date
, Seq1
, Seq2
and X
values.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install row-oriented-workflows
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page