R에서 Google 웹 로그 분석 데이터를 분석하고 rCharts 패키지를 통해 NVD3과 함께 표시합니다. 그러나 차트의 모든 데이터 요소가 하루 일찍 (6 월 21 일과 올바른 6 월 22 일)이기 때문에 날짜가 잘못된 시간대에 설정되어 있다고 생각합니다. N.B. Google 웹 로그 분석은 적어도 웹 앱에서는 EST로보고하도록 설정되어 있습니다.R 및 D3의 날짜가 잘못되었습니다.
sources <- ga$getData(...) # Using rga to pull data from Analytics
> dput(sources)
structure(list(date = structure(c(16243, 16243, 16243, 16243,
16244, 16244, 16244), class = "Date"), medium = c("(none)", "cpc",
"organic", "referral", "(none)", "cpc", "organic"), sessions = c(9,
50, 5, 3, 3, 68, 9)), .Names = c("date", "medium", "sessions"
), row.names = c(NA, 7L), class = "data.frame")
lineChart <- nPlot(sessions ~ date, group = 'medium', data = sources, type = "lineWithFocusChart")
lineChart$xAxis(tickFormat = "#!function(d) {return d3.time.format('%b %d')(new Date(d*1000*3600*24)); }!#") # Fixing date to show only month and day (ordinal)
lineChart$show()
R 날짜는 시간대가 없습니다 (그리고 R의 datetimes로 강제 변환 될 때 GMT의 자정이 사용됩니다). D3에 사용해야하는 날짜 등급이 있습니까? –
그것은 그렇게 보인다. 그러나 불행하게도 그것은 나의 머리 위에 길을 날고있다. https://github.com/mbostock/d3/wiki/Time-Formatting – mattpolicastro