tpemartin / 110-1-r4ds-main

MIT License
3 stars 73 forks source link

Exercise 4.13 Regarding johnDoe in exercise 1 of Exercise section, #47

Open tpemartin opened 2 years ago

tpemartin commented 2 years ago

Exercise 4.13 Regarding johnDoe in exercise 1 of Exercise section,

  1. For those whose reported unit (通報機構) is not NA, what are their records? (in other words, construct a reported-unit-not-NA subsample)

  2. For those dead bodies reported (通報機構) by “海巡隊” (use =="海巡隊" here. Ignore other similar unit names), what are their death types (死亡方式描述)? How many bodies in each type?

  3. For those whose death type (死亡方式描述) is 不詳 or 他殺, what are their discovered counties (發現縣市)? How many such bodies in each counties?

AmyChen20021003 commented 2 years ago

https://github.com/AmyChen20021003/110-1-r4ds-main/blob/0a8f96b897424bdebeef7e07178c3dfb653e2297/4-13.Rmd#L11

raychiu135 commented 2 years ago

https://github.com/raychiu135/110-1-r4ds-main/blob/dff7f48a7555306e0773d7f669954eecb67737c0/exercise_4.13.rmd#L2

stone05261234 commented 2 years ago

https://github.com/stone05261234/110-1-r4ds-main/blob/08e97cd622073eb1bdceae9f5fe308d48cda2f72/4.13%20try%20to%20do#L1

linttttt commented 2 years ago

https://github.com/linttttt/110-1-r4ds-main/blob/970b7d553541c5a077e65d44c355941f1f37f433/studyCH4(EX).Rmd#L137

32119811 commented 2 years ago

https://github.com/32119811/110-1-r4ds-main/blob/294f393a71d4994c240a600b6c0b6ff7d1dcfa6e/Exercise%204.13#L24

tpemartin commented 2 years ago

@AmyChen20021003, @stone05261234 Please check:

@AmyChen20021003

The following is wrong.

#3
pick3<-johnDoe[["data"]][["死亡方式描述"]]==c("不詳","他殺")
country<-johnDoe[["data"]][["發現縣市"]][pick3]
table(country)

@stone05261234

Errors:

https://github.com/stone05261234/110-1-r4ds-main/blob/08e97cd622073eb1bdceae9f5fe308d48cda2f72/4.13%20try%20to%20do#L11 https://github.com/stone05261234/110-1-r4ds-main/blob/08e97cd622073eb1bdceae9f5fe308d48cda2f72/4.13%20try%20to%20do#L20

AmyChen20021003 commented 2 years ago

https://github.com/AmyChen20021003/110-1-r4ds-main/blob/15ae42c3f498b1f38e82f6178589a65db350a176/4-13.Rmd#L25