search for: group_data

Displaying 2 results from an estimated 2 matches for "group_data".

2024 May 25
1
dplyr, group_by and selective action according to each group
...hings you can access such as if you want to keep only the first record in each group, you can filter by row_number==1, or use the do() function. The dplyr (and related packages) keep evolving and functionality may be deprecated, but check this page for ideas: https://dplyr.tidyverse.org/reference/group_data.html Some of those may give you access to which rows are in each group and to other ways to approach the problem somewhat from outside after grouping so you can apply your function to the subset of the rows you want. -----Original Message----- From: R-help <r-help-bounces at r-project.org...
2024 May 24
1
dplyr, group_by and selective action according to each group
Laurent: As I don't use dplyr, this won't help you, but I hope you and others may find it entertaining anyway. If I understand you correctly (and ignore this if I have not), there are a ton of ways to do this in base R, including using switch() along the lines you noted in your post. However, when the functions get sufficiently complicated or numerous, it may be useful to store them in a