Re: [問題] if elso loop不能接著執行?
※ 引述《Edster (Edster)》之銘言:
: best <- function(x, y){
: z <- c("heart attack", "heart failure", "pneumonia")
: outcome <- read.csv(file="outcome-of-care-measures.csv", header=T, as.is=T)
: SS <- as.numeric(outcome[,11])
: if (! (x %in% outcome$State) | ! (y %in% z)){
: stop("Error in best(state, outcome) : invalid state")
: }
: if (y == "heart attack"){
: select = outcome$State == x & !is.na(SS); o = order(SS)
: result <- outcome[o[select],c(1,2)]
: print(paste("best (", result, ") heart attack"))
: }
: }
請問從倒數第三行(select = outcome$State....)之後,
為何我用
o <- order(SS[select])
outcome.order <- outcome[o, ]
結果outcome.order還是有NA值存在?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.175.163.115
※ 文章網址: http://www.ptt.cc/bbs/R_Language/M.1414939348.A.EBB.html
推
11/04 23:26, , 1F
11/04 23:26, 1F
→
11/04 23:26, , 2F
11/04 23:26, 2F
推
11/04 23:51, , 3F
11/04 23:51, 3F
→
11/04 23:53, , 4F
11/04 23:53, 4F
→
11/04 23:53, , 5F
11/04 23:53, 5F
→
11/04 23:53, , 6F
11/04 23:53, 6F
→
11/04 23:55, , 7F
11/04 23:55, 7F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 3 之 3 篇):
R_Language 近期熱門文章
PTT數位生活區 即時熱門文章