The function timing_atc_group()
calculates the frequencies of distinct
timing and ATC combinations within clusters.
timing_atc_group(
object,
only = NULL,
clusters = NULL,
atc_groups = default_atc_groups,
additional_data = NULL,
...
)
timing_atc_group()
returns a list of class
timing_atc_group
with two data frames:
Clustering
the name of the clustering.
Cluster
the name of the cluster.
ATC Groups
the name of the ATC group. The groups are given by the
atc_groups
input.
timing variables the average timing value in the ATC group and cluster.
Number of Medications
the number of medications in the ATC group in
the cluster.
Percentage of Medications
the percentage of medication in the cluster
with this ATC group.
Number of Distinct Timing Trajectories
the number of unique timing
trajectories in the ATC group in the cluster.
Clustering
the name of the clustering.
Cluster
the name of the cluster.
timing variables a unique timing pattern in the ATC group and cluster.
Number of Medications with Timing Trajectory
the number of medications
with this unique timing trajectory and ATC group.
An object for which a summary is desired.
<data-masking
> Expressions that
return a logical value, and are defined in terms of the variables in
object
and/or additional_data
.
The default NULL
selects all clusterings in object
.
<tidy-select
> An unquoted
expression naming the cluster or clusters in object
one wants to
see summaries of. Names can be used as if they were positions in the data
frame, so expressions like I:IV can be used to select a range of clusters.
The default NULL
selects all clusters in the chosen clusterings of
object
.
A data.frame specifying the ATC groups to summaries by or a funciton that returns such a data.frame. The data.frame must have two columns:
regex
giving regular expressions specifying the wanted ATC groups.
atc_groups
the name of this ATC grouping.
As a standard the anatomical level (first level) of the ATC codes is used.
A data frame with additional data that may be
(left-)joined onto the parameters
in object
. This is often
used in conjuction with only
to select specific clusterings based on
additional_data
.
Additional arguments passed to the specific summary sub-function.
timing_atc_group()
calculates both the number of people with unique timing
trajectory and ATC group, as given by atc_groups
, in each cluster.
clust <- medic(
complications,
id = id,
atc = atc,
k = 3:5,
timing = first_trimester:third_trimester
)
timing_atc_group(clust, k == 5, clusters = I:III)
Run the code above in your browser using DataLab