• 沒有找到結果。

Rstudio environment and basic operation  C. Rstudio tools

在文檔中 精準醫學數據研究 (頁 123-169)

I. Getting Rstudio II. Getting Rstudio

A.Downloading and Installing Rstudio 

B. Rstudio environment and basic operation 

Tools >> Global Operations

Tools >> Global Operations

• General - Basic

• 開啟時是否恢復workspace資料 關閉軟體  再開啟  存有紀錄

• 是否儲存目前 workspace 資料設定

Tools >> Global Operations

• Code – Display

Tools >> Global Operations

• Code – Saving

• 儲存繁體中文 encoding 方式

Tools >> Global Operations Appearance

Tools >> Global Operations 1. General

2. Code

3. Appearance

實作 Practice

Acute Inflammations Data Set

J.Czerniak, H.Zarzycki, Application of rough sets in the presumptive diagnosis of urinary system diseases, Artifical Inteligence and Security in Computing Systems, ACS'2002 9th International Conference Proceedings, Kluwer Academic Publishers,2003, pp. 41-51

急性膀胱炎

Inflammation of urinary bladder 腎盂腎炎Nephritis of renal pelvis origin

常發生在女性

突然高燒,體溫常超過40°C

高燒伴隨顫抖、雙邊或單側的腰椎異常疼痛

排尿疼痛

可能不規律的發生噁心、嘔吐、腹部疼痛

突發性腹部疼痛

常見排尿困難、排尿疼痛、頻尿

體溫升高,但常不超過38°C

排出尿液混濁,有時會有血尿

資料整理

{共120個觀察值, 6個變項, 其中㇐個連續型變項, 5個類別變項}

Temperature

體溫 Nausea

噁心 Lumbar pain

腰椎痛 Urine pushing

排尿困難 Micturition pains 排尿疼痛

Burning of urethra 尿道灼熱, 搔癢

35,5 no yes no no no

35,9 no no yes yes yes

35,9 no yes no no no

36,0 no no yes yes yes

36,0 no yes no no no

Coding book 譯碼簿

變項編號 變項英文名稱 變項中文名稱 單位

V1 Temperature 體溫 °C 連續變項

V2 nausea 噁心 0:無(no)

1:有(yes)

V3 Lumbar pain 腰椎痛 0:無(no)

1:有(yes)

V4 Urine pushing 排尿困難 0:無(no)

1:有(yes)

V5 Micturition pains 排尿疼痛 0:無(no)

1:有(yes) V6 Burning of urethra 尿道灼熱, 搔癢 0:無(no)

1:有(yes)

Alt+Enter : 下㇐行

資料整理

Temperature

體溫 Nausea

噁心 Lumbar pain

腰椎痛 Urine pushing

排尿困難 Micturition pains

排尿疼痛 Burning of urethra 尿道灼熱, 搔癢

35,5 no yes no no no

35,9 no no yes yes yes

35,9 no yes no no no

36,0 no no yes yes yes

36,0 no yes no no no

,  .

yes  1

no  0

{共120個觀察值, 6個變項, 其中㇐個連續型變項, 5個類別變項}

AND、OR、NOT

Temperature

體溫 Nausea

噁心 Lumbar pain

腰椎痛 Urine pushing

排尿困難 Micturition pains

排尿疼痛 Burning of urethra 尿道灼熱, 搔癢

35,5 no yes no no no

35,9 no no yes yes yes

35,9 no yes no no no

36,0 no no yes yes yes

36,0 no yes no no no

急性膀胱炎

Inflammation of urinary bladder 腎盂腎炎Nephritis of renal pelvis origin

常發生在女性

突然高燒,體溫常超過40°C

高燒伴隨顫抖、雙邊或單側的腰椎異常疼痛

排尿疼痛

可能不規律的發生噁心、嘔吐、腹部疼痛

突發性腹部疼痛

常見排尿困難、排尿疼痛、頻尿

體溫升高,但常不超過38°C

排出尿液混濁,有時會有血尿

Cystitis_1

排尿困難且排尿疼痛 Cystitis_2

排尿困難或排尿疼痛或尿道灼熱

Save file

Add comment

Set working directory. Read data.

No. of variables. No. of observations.

Column?

Row?

變項 variables

觀察值observations

No. of variables. No. of observations.

Creating new variables.[ifelse()] [AND、OR、NOT]

ifelse(test_expression, x, y)

> a = c(5,7,2,9)

> ifelse(a %% 2 == 0,"even","odd")

[1] "odd" "odd" "even" "odd"

Cystitis_1

排尿困難且排尿疼痛

Urine.pushing

=="yes" Micturition.pain s =="yes"

練習

(Urine.pushing ==“no“) AND (Micturition.pains ==“no")

No. of conditional observations.

Cystitis_1

排尿困難且排尿疼痛

49位 膀胱炎 + 71位非膀胱炎 = 120位 (確認是否與總數相符合)

確認是否Cystitis_1 = “TRUE”時

Urine pushing=1 且 Micturition pains=1 Cystitis_1 = “FALSE”時

Urine pushing=? Micturition pains=?

至少㇐個=0? 49 + 71 =120 check

• Cystitis_1

排尿困難且排尿疼痛

=AND(D2=1,E2=1)

• Cystitis_2

排尿困難或排尿疼痛或尿道灼熱

=OR(C2=1,D2=1,E2=1)

符合排尿困難或排尿疼痛或尿道灼熱 之膀胱炎與非膀胱炎定義患者各有幾位?

練習

Nephritis_D

若 體溫 ≥ 38°C 且 腰椎疼痛 [Lumber pain]

Nephritis_D 就 等於 1, 否則 Nephritis_D等於 0

= IF(AND(A2>=38,C2=1 ), 1, 0)

練習

• Cystitis_D

條件1:體溫 < 38°C 且 排尿困難 [Urine pushing]

條件2:排尿困難 [Urine pushing] 且 排尿疼痛 [Micturition pains]

若 符合條件1 或是 條件2 則 Cystitis_D 就 等於 1, 否則 Cystitis_D 等於 0 IF、OR、AND

“Knowledge is the collection of skills and information a person has

acquired through experience. Intelligence is the ability to apply knowledge.”

“Knowledge is wonderful, but it fades as techniques and technologies come and go. Intelligence sustains. Its borders extend beyond any technique or technology, and that makes all the difference.”

Anthony Colangelo

https://alistapart.com/blog/post/knowledge-vs-intelligence/#:~:text=Knowledge%20is%20the%20collection%20of,intelligence%20to%20help%20solve%20problems.

回家作業

E-mail: ijfeng@g-mail.nsysu.edu.tw

Title: [101-1 高中生物科學資優生培育計畫-高雄區_姓名_學號]

答案 [EXCEL]

程式碼 [R]

Echocardiogram Data Set 心臟超音波資料集

Donor: Steven Salzberg and Dr. Evlin Kinney

變項編號 變項英文名稱 變項中文名稱 單位 解釋

V1 age-at-heart-attack 心臟病發病年齡 year(s) 連續變項 V2

pericardial-effusion 心包膜積水 0:無(no)

1:有(yes) V3

fractional-shortening 短縮分率 左心收縮力指標之㇐,數值越高越不正常○

V4 epss epss E-point septal separation ○ 左心收縮力指標之

㇐,數值越高越不正常○

V5 lvdd 左心室舒張末期內

left ventricular end-diastolic dimension○ 舒張 末期心臟大小,數值越大越不正常○

V6 wall-motion-index 室壁運動記分指數 室壁運動異常程度,數值越高越不正常○

1. 共有 1-1觀察值, 有 1-2 個變項○

我們欲根據心臟超音波研究結果找出有哪些心臟病發患者心臟病發後生存年份短於1年○

研究發現年齡大於65歲老年人, 若 fractional-shortening大於等於0.15 且 EPSS大於等於10且LVDD大於 等於4.5 且 wall-motion-index大於1.0 則患者存活時間短於1年○

2. 有幾位病患 心臟病發病時年齡大於等於65 歲?

3. 有幾位病患 fractional-shortening大於等於0.15?

4. 有幾位病患 EPSS大於等於10?

5. 有幾位病患 LVDD大於等於4.5?

6. 有幾位病患 wall-motion-index大於1.0?

7. 1~5條件皆符合得有幾位?

研究另外發現年齡小於65歲者, 雖然fractional-shortening小於0.15 ,但是EPSS、LVDD與wall-motion-index 3項其中2項以上符合更為嚴苛的條件時,患者存活時間短於1年○

8. 有幾位病患 心臟病發病時年齡小於65 歲?

9. 有幾位病患 fractional-shortening小於0.15?

10.有幾位病患 EPSS大於等於15?

11.有幾位病患 LVDD大於等於4.5?

12.有幾位病患 wall-motion-index大於2.0?

13. 有幾位病患符合條件9、10 、11中2項以上者?

14.有幾位病患符合條件7 且條件8且條件12者?

15.根據研究所發現特徵,請問共有幾位患者存活時間短於1年 (符合條件6或是條件13) ?

答案

在文檔中 精準醫學數據研究 (頁 123-169)

相關文件