R 的日期入門

R 金融中級

Lore Dirick

Manager of Data Science Curriculum at Flatiron School

你會學到什麼?

  • If 陳述式
  • 迴圈
  • 函式
  • 財務範例
R 金融中級

今天的日期

today <- Sys.Date()
today
"2017-03-14"
class(today)
"Date"
R 金融中級

日期類別

  • Date
    • 行事曆日期
    • "2017-03-14"
  • POSIX - Portable Operating System Interface
    • POSIXctPOSIXlt
    • 日期+時間+時區
    • "2017-03-14 10:00:21 EDT"
R 金融中級

建立日期

character_date <- "1957-03-04"

class(character_date)
"character"
sp500_birthday <- as.Date(character_date)

sp500_birthday
"1957-03-04"
class(sp500_birthday)
"Date"
R 金融中級

一起來練習吧!

R 金融中級

Preparing Video For Download...