Construct Age Group Column to Dataset
construct_weight_group.Rd
This function takes a dataset and adds a new column that contains age groups.
Examples
df <- data.frame(id = 1:10, weights = c(23, 45, 34, 56, 29, 12, 67, 44, 33, 55))
new_df <- construct_age_group(df, age_col = "weights", group_size = 0.25)
print(new_df)
#> id weights fert_age_grp
#> 1 1 23 23-22.25
#> 2 2 45 45-44.25
#> 3 3 34 34-33.25
#> 4 4 56 56-55.25
#> 5 5 29 29-28.25
#> 6 6 12 12-11.25
#> 7 7 67 67-66.25
#> 8 8 44 44-43.25
#> 9 9 33 33-32.25
#> 10 10 55 55-54.25