View source: R/dataframe_utilities.R
combine_rows_by_tol | R Documentation |
Combine data frame rows by tolerance on a value
combine_rows_by_tol(df, values = "TIME", tol = 0, ...)
df |
A dataframe object |
values |
the quoted name of the column on which to combine rows |
tol |
The tolerance within value in which to combine rows |
... |
Summary function to adjust or create columns within the combined row |
the modified dataframe
set.seed(12345)
vals = runif(100,0,100)
vals = vals[order(vals)]
data1 = data.frame(TIME=vals, SEX=sample(x=0:1,size = 100,replace=TRUE), AMT=100)
# make groups where start is within tol=0.5
combine_rows_by_tol(data1, values="TIME", tol=0.5, AMT=sum(AMT))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.