Skip to content

Instantly share code, notes, and snippets.

@abikoushi
Created January 5, 2015 21:13
Show Gist options
  • Select an option

  • Save abikoushi/945e21182143c1cf3647 to your computer and use it in GitHub Desktop.

Select an option

Save abikoushi/945e21182143c1cf3647 to your computer and use it in GitHub Desktop.
Function to go date object "yearMonth" and "date" of RGoogleAnalytics
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)
}
@abikoushi
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment