医院病例数据分析项目
JHU DataScience Specialization/Cousers Rprogramming/Week3/Course Project 3
作业练习目标:通过分析医院数据,编写函数,通过函数分析各州医院指定的病例排名
- [x] 数据源:outcome-of-care-measures.csv
Contains information about THIRTY(30)-day mortality and readmission rates for heart attacks,heart failure, and pneumonia for over FOUR THOUSAND (4,000) hospitals;
- [x] 说明书:Hospital_Revised_Flatfiles.pdf
30天死亡最率最低的医院
输出指定州(例子德州TX)函数(best)
1 | best <- function(state, outcome) { |
例子:输出指定州(德州TX)30天死亡最率最低的医院
1 | # Warning in which.min(df[, 2]): 强制改变过程中产生了NA |
1 | # [1] "Hospital with lowest 30-day death rate is: CYPRESS FAIRBANKS MEDICAL CENTER" |
心脏病死亡率最低医院
输出前10字母排名州的心脏病死亡最低医院(rankall)
1 | rankall <- function(outcome="heart attack", num=1) { |
例子:二十间心脏病死亡率最低医院A-Z
1 | pander(head(rankall("heart attack", 1), 20)) |
No. | hospital | state |
---|---|---|
1 | PROVIDENCE ALASKA MEDICAL CENTER | AK |
2 | CRESTWOOD MEDICAL CENTER | AL |
3 | ARKANSAS HEART HOSPITAL | AR |
4 | MAYO CLINIC HOSPITAL | AZ |
5 | GLENDALE ADVENTIST MEDICAL CENTER | CA |
6 | ST MARYS HOSPITAL AND MEDICAL CENTER | CO |
7 | WATERBURY HOSPITAL | CT |
8 | PROVIDENCE HOSPITAL | DC |
9 | BAYHEALTH - KENT GENERAL HOSPITAL | DE |
10 | MOUNT SINAI MEDICAL CENTER | FL |
11 | STEPHENS COUNTY HOSPITAL | GA |
12 | GUAM MEMORIAL HOSPITAL AUTHORITY | GU |
13 | HILO MEDICAL CENTER | HI |
14 | MARY GREELEY MEDICAL CENTER | IA |
15 | PORTNEUF MEDICAL CENTER | ID |
16 | SAINT JOSEPH HOSPITAL | IL |
17 | ST VINCENT HEART CENTER OF INDIANA LLC | IN |
18 | KANSAS HEART HOSPITAL | KS |
19 | ST ELIZABETH MEDICAL CENTER NORTH | KY |
20 | ST FRANCIS MEDICAL CENTER | LA |
综合函数,指定医院指定,指定病例,指定排位
1 | rankhospital <- function(state, outcome, num = "best") { |
例子:德州心脏病死亡率第四名低的医院
1 | ## Warning in rankhospital("TX", "heart attack", 4): 强制改变过程中产生了NA |
1 | # [1] "Texias with Heart Attack and lowest 4th death rate is: PARKLAND HEALTH AND HOSPITAL SYSTEM" |