#option 1: long form requires a group_by and a single e_line call df_long |>group_by(name) |>e_charts(x = Date) |>e_line(serie = value)
Code
#option 2: wide form can skip the grouping but needs two separate e_line calls df |>e_charts(x = Date) |>e_line(serie = Temp) |>e_line(serie = Wind) |>e_tooltip(trigger ="item") |>#mouse over item for its value e_title(text ="Example Plot", #add title subtext ="generated from wide form") |>#add subtitle e_axis_labels(x ="Month in 1973", #add axis labelsy ="Whatever, I don't really care") |>e_x_axis(nameLocation ='center') |>#axis label placement (default: right)e_y_axis(nameLocation ="center") #axis label placement (default: top left)
Thank you to Travis Gerke for developing this example.
Code
study_cohorts <- trial_data |>cohort_start("Assessed for eligibility") |># Define cohorts using named expressions --------------------# Notice that you can use previously defined cohorts in subsequent stepscohort_define(consented = .full |>filter(declined !=1),consented_chemonaive = consented |>filter(prior_chemo !=1),randomized = consented_chemonaive |>filter(bone_mets !=1),treatment_a = randomized |>filter(treatment =="Drug A"),treatment_b = randomized |>filter(treatment =="Drug B"),# anti_join is useful for counting exclusions -------------excluded =anti_join(.full, randomized, by ="id"),excluded_declined =anti_join(.full, consented, by ="id"),excluded_chemo =anti_join(consented, consented_chemonaive, by ="id"),excluded_mets =anti_join(consented_chemonaive, randomized, by ="id") ) |># Provide text labels for cohorts ---------------------------cohort_label(consented ="Consented",consented_chemonaive ="Chemotherapy naive",randomized ="Randomized",treatment_a ="Allocated to arm A",treatment_b ="Allocated to arm B",excluded ="Excluded",excluded_declined ="Declined to participate",excluded_chemo ="Prior chemotherapy",excluded_mets ="Bone metastasis" )