R programming week #4 assigment
来源:互联网 发布:更改路由器端口 编辑:程序博客网 时间:2024/05/16 23:56
## best.R
best <- function(state, outcome) {
## Read outcome datadata <- read.csv("~/Documents/F data/4 R programming/week 4/rprog%2Fdata%2FProgAssignment3-data/outcome-of-care-measures.csv",colClass = "character", na.strings = "Not Available")
## Check that state and outcome are valid
validOutcome = c("heart attack", "heart failure", "pneumonia")
if(!outcome %in% validOutcome) stop(print("invalid outcome"))
validState = unique(data[ ,7])
if(!state %in% validState) stop(print("invalid state"))
## convert outcome name into column name
fullColName <- c(11, 17, 23)
colName <- fullColName[match(outcome, validOutcome)]
## Return hospital name in that state with lowest 30-day death rate
data.state <- data[data$State == state, ]
idx <- which.min(as.double(na.omit(data.state[ ,colName])))
data.state[idx, "Hospital.Name"]
}
0 0
- R programming week #4 assigment
- R Programming week 3-Debugging
- R Programming week 3-Loop functions
- R Programming Note 4
- R Programming: Part 4 - Simulation & Base Graphics
- R Programming: Part 2 - Programming with R
- R Programming -- basic R expressions
- Machine Learning week 4 programming exercise One vs All and Neural network
- Machine Learning week 4 quiz: programming assignment-Multi-class Classification and Neural Networks
- Machine Learning week 1 Programming Excercise
- Stanford - Cryptography I - Week 3 Programming Assignment
- [week 7][Leetcode][Dynamic Programming]Triangle
- [week 8][Leetcode][Dynamic Programming] Maximum Subarray
- [week 10][Leetcode][Dynamic Programming] Climbing Stairs
- [week 11][Leetcode][Dynamic Programming] House Robber
- [week 12][Leetcode][Dynamic Programming] Unique Paths
- Week 4
- week 4
- UVA694 - The Collatz Sequence
- 1067. Sort with Swap(0,*) (25)-PAT甲级真题(贪心算法)
- codeforces707Cdiv2Pythagorean Triples+勾股数
- 使用LUA userdata手动绑定C++对象
- UVA457 - Linear Cellular Automata
- R programming week #4 assigment
- linux下各种*-dev或*-devel包的作用
- codeforces707Bdiv2Bakery+贪心
- 51nod 1126 求递推序列的第N项
- 13章广义线性模型
- codeforces707Adiv2Brain's Photos+水题
- 【bzoj 1798】[AHOI2009]维护序列
- Qt5.7.0 日志输出文件之debug重定向
- 1038. Recover the Smallest Number (30)-PAT甲级真题(贪心算法)