[問題] r讀取問題

看板R_Language作者 (吸收正能量)時間6年前 (2018/07/08 17:49), 編輯推噓1(104)
留言5則, 3人參與, 6年前最新討論串1/1
[問題類型]: 入門(寫過其他程式,只是對語法不熟悉) [問題敘述]: 於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

07/08 20:35, 6年前 , 1F
有些日期的資料是NA,這預設資料來源是yahoo finance
07/08 20:35, 1F

07/08 20:36, 6年前 , 2F
去網站上看就可以發現NA的那些天都是沒資料的
07/08 20:36, 2F

07/08 21:54, 6年前 , 3F
那你就用 na.omit()把空值清掉,不然分析會有問題
07/08 21:54, 3F

07/09 10:05, 6年前 , 4F
那請問我該把na.omit 函數加在哪裡? 謝謝~
07/09 10:05, 4F

07/09 12:37, 6年前 , 5F
newdata=na.omit(tw3008) 應該這樣就行ㄌ
07/09 12:37, 5F
文章代碼(AID): #1RGTuPLL (R_Language)