看板 R_Language 關於我們 聯絡資訊
[問題類型]: 入門(寫過其他程式,只是對語法不熟悉) [問題敘述]: 於Rstudio環境下,執行程式範例中的語法出現下列警告,請問可以怎麼排除問題? Warning message: 3008.TW contains missing values. Some functions will not work if objects contain missing values in the middle of the series. Consider using na.omit(), na.approx(), na.fill(), etc to remove or replace them. [程式範例]: install.packages("quantmod") require("quantmod") library(quantmod) tw3008=getSymbols("3008.TW",from = "2010-01-01",to = Sys.Date()) [環境敘述]: Rstudio windows 7 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.38.225.198 ※ 文章網址: https://www.ptt.cc/bbs/R_Language/M.1531043353.A.555.html
eri820503: 有些日期的資料是NA,這預設資料來源是yahoo finance 07/08 20:35
eri820503: 去網站上看就可以發現NA的那些天都是沒資料的 07/08 20:36
joedenkidd: 那你就用 na.omit()把空值清掉,不然分析會有問題 07/08 21:54
shingai: 那請問我該把na.omit 函數加在哪裡? 謝謝~ 07/09 10:05
joedenkidd: newdata=na.omit(tw3008) 應該這樣就行ㄌ 07/09 12:37