Numeric Dates to String date

I am loading time series date into R as a data frame. However, the time series dates aren't being displayed as string when I view the data, though the class of the date column is recognized as a date class. Without using zoo, how can I get the dataset to display the dates in string format. This is really for visual purposes to be able to see if the data is correct. Date Open High Low Close Volume Adj Close 3/8/2013 834.5 834.92 825.05 831.52 2911900 831.52 3/7/2013 834.06 836.62 829.58 832.6 2052700 832.6 3/6/2013 841.03 844 828.81 831.38 2873000 831.38 3/5/2013 828.93 840.15 828.9 838.6 4044100 838.6 3/4/2013 805.3 822.84 805 821.5 2775600 821.5 is displayed in R as: Date Open High Low Close Volume Adj.Close 15772 834.50 834.92 825.05 831.52 2911900 831.52 15771 834.06 836.62 829.58 832.60 2052700 832.60 15770 841.03 844.00 828.81 831.38 2873000 831.38 15769 828.93 840.15 828.90 838.60 4044100 838.60 15768 805.30 822.84 805.00 821.50 2775600 821.50 15765 797.80 807.14 796.15 806.19 2175400 806.19 I am using the command data=read.csv("file location",header=T,colClasses=c("Date","numeric","numeric","numeric","numeric","numeric","numeric")) Here is the dput output: dput(head(data)) structure(list(Date = structure(c(15772, 15771, 15770, 15769, 15768, 15765), class = "Date"), Open = c(834.5, 834.06, 841.03, 828.93, 805.3, 797.8), High = c(834.92, 836.62, 844, 840.15, 822.84, 807.14), Low = c(825.05, 829.58, 828.81, 828.9, 805, 796.15), Close = c(831.52, 832.6, 831.38, 838.6, 821.5, 806.19 ), Volume = c(2911900, 2052700, 2873000, 4044100, 2775600, 2175400 ), Adj.Close = c(831.52, 832.6, 831.38, 838.6, 821.5, 806.19)), .Names = c("Date", "Open", "High", "Low", "Close", "Volume", "Adj.Close"), row.names = c(NA, 6L), class = "data.frame")
can you give small sample data?

以上就是Numeric Dates to String date的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏