Skip to content

Commit 73d929c

Browse files
committed
minor fix
1 parent f456c23 commit 73d929c

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

what-is-tidier-jl.jl

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,12 @@ No. The `meds_clean` data frame only captures patients who are taking at least o
337337
To evaluate this, let's join the `patients_clean` data frame with `meds_clean_count` and examine the `num_meds` column. If all patients in the `patients_clean` data frame are also represented in the `meds_clean_count` data frame, then there should be no missing values for `num_meds`.
338338
"""
339339

340+
# ╔═╡ 597f559a-abd5-4ceb-b23f-1e32b7e5e78b
341+
@chain begin
342+
@left_join(patients_clean, meds_clean_count)
343+
@count(num_meds)
344+
end
345+
340346
# ╔═╡ 4cb280c9-0f4b-4173-8858-6c1253496d6a
341347
md"""
342348
While most patients in this dataset are taking at least one medication, `348` patients have a `missing` value for `num_meds` after joining the two datasets, which means that they are not on medications.
@@ -352,15 +358,25 @@ We will add a `@count(num_meds)` at the end of the chain to confirm that the `mi
352358
In previous code, we have always started a chain with the syntax `@chain df begin`, where `df` represents a data frame. You can alternatively begin a chain with `@chain begin`, which is especially handy when the initial value is lengthy to type, such as when starting a chain with a `@left_join`.
353359
"""
354360

361+
# ╔═╡ 6ea5a632-0c97-4a8d-90ea-7add7dc99304
362+
@chain begin
363+
@left_join(patients_clean, meds_clean_count)
364+
@mutate(num_meds = replace_missing(num_meds, 0))
365+
@count(num_meds)
366+
end
367+
355368
# ╔═╡ f62652d2-43f9-4728-8ff1-856bc26a530e
356369
md"""
357370
The 348 `missing` values are now zeros, so let's recalculate the average.
358371
"""
359372

360-
# ╔═╡ 597f559a-abd5-4ceb-b23f-1e32b7e5e78b
373+
# ╔═╡ 6f1d3c1f-6c77-4474-a69f-bb663c27b6cc
361374
@chain begin
362375
@left_join(patients_clean, meds_clean_count)
363-
@count(num_meds)
376+
@mutate(num_meds = replace_missing(num_meds, 0))
377+
@summarize(mean_num_meds = mean(num_meds),
378+
min_num_meds = minimum(num_meds),
379+
max_num_meds = maximum(num_meds))
364380
end
365381

366382
# ╔═╡ 773fba31-b9ad-4db6-a70b-55fc7dd18372
@@ -431,22 +447,6 @@ If you've been carefully looking through the code, following along, and everythi
431447
The next section on reading data will cover the details, starting with how to read in a data frame from a file.
432448
"""
433449

434-
# ╔═╡ 6ea5a632-0c97-4a8d-90ea-7add7dc99304
435-
@chain begin
436-
@left_join(patients_clean, meds_clean_count)
437-
@mutate(num_meds = replace_missing(num_meds, 0))
438-
@count(num_meds)
439-
end
440-
441-
# ╔═╡ 6f1d3c1f-6c77-4474-a69f-bb663c27b6cc
442-
@chain begin
443-
@left_join(patients_clean, meds_clean_count)
444-
@mutate(num_meds = replace_missing(num_meds, 0))
445-
@summarize(mean_num_meds = mean(num_meds),
446-
min_num_meds = minimum(num_meds),
447-
max_num_meds = maximum(num_meds))
448-
end
449-
450450
# ╔═╡ 00000000-0000-0000-0000-000000000001
451451
PLUTO_PROJECT_TOML_CONTENTS = """
452452
[deps]
@@ -2674,7 +2674,7 @@ version = "0.2.1"
26742674
26752675
[[deps.Tidier]]
26762676
deps = ["Reexport", "TidierCats", "TidierDB", "TidierData", "TidierDates", "TidierFiles", "TidierIteration", "TidierPlots", "TidierStrings", "TidierText", "TidierVest"]
2677-
git-tree-sha1 = "e9377630c8467e5351d1a7d88911c07a1c7df17f"
2677+
git-tree-sha1 = "5cdf1d3b301d1da628573493931842b4fac0bea6"
26782678
uuid = "f0413319-3358-4bb0-8e7c-0c83523a93bd"
26792679
version = "1.6.1"
26802680

0 commit comments

Comments
 (0)