Created
January 5, 2015 21:13
-
-
Save abikoushi/945e21182143c1cf3647 to your computer and use it in GitHub Desktop.
Function to go date object "yearMonth" and "date" of RGoogleAnalytics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| as.Date4ga <- function(x){ | |
| nc <-nchar(x) | |
| y <- substr(x,1,4) | |
| m <-substr(x,5,6) | |
| d <-substr(x,7,8) | |
| t1 <-ifelse(nc==6,paste(y,m,"01",sep="/"),paste(y,m,d,sep="/")) | |
| as.Date(t1) | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
see http://abrahamcow.hatenablog.com/