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
| haiku = function () { | |
| adjs = c( | |
| "autumn", "hidden", "bitter", "misty", "silent", "empty", "dry", "dark", | |
| "summer", "icy", "delicate", "quiet", "white", "cool", "spring", "winter", | |
| "patient", "twilight", "dawn", "crimson", "wispy", "weathered", "blue", | |
| "billowing", "broken", "cold", "damp", "falling", "frosty", "green", | |
| "long", "late", "lingering", "bold", "little", "morning", "muddy", "old", | |
| "red", "rough", "still", "small", "sparkling", "throbbing", "shy", | |
| "wandering", "withered", "wild", "black", "young", "holy", "solitary", | |
| "fragrant", "aged", "snowy", "proud", "floral", "restless", "divine", |
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
| needed = c("lubridate", "dplyr", "data.table", "stringr") | |
| is.installed <- function(pkg){is.element(pkg, installed.packages()[,1])} | |
| for (p in 1:length(needed)){ifelse(!is.installed(needed[p]), install.packages(needed[p], dependencies = T),print(paste(needed[p], " is already installed", sep = "")))} | |
| library(lubridate) | |
| library(dplyr) | |
| library(data.table) #used for the %like% function | |
| library(stringr) |
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
| needed = c("lubridate", "dplyr", "data.table", "stringr") | |
| is.installed = function(pkg){ | |
| is.element(pkg, installed.packages()[,1]) | |
| } | |
| # For loop to run through each of the packages | |
| for (p in 1:length(needed)){ | |
| ifelse(!is.installed(needed[p]), install.packages(needed[p], dependencies = T), print(paste(needed[p], " is already installed", sep = ""))) | |
| } |
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
| library(httr) | |
| library(stringr) | |
| dat = read.csv("fileWithURLs.csv", stringsAsFactors = F) | |
| ---------------- for loop to get results ---------------- | |
| for (i in 1:nrow(dat)) { | |
| a = GET(dat$Current.Forward[i]) | |
| dat$URL[i] = a$url |
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
| urlStatusChecker = function(file,urlcol) { | |
| library(httr) | |
| dat = read.csv(file, stringsAsFactors = F) | |
| for (i in 1:nrow(dat)) { | |
| dat = dat[dat[urlcol] != "",] | |
| dat = dat = dat[!is.na(dat[urlcol]),] | |
| a = GET(dat[i,urlcol]) | |
| dat$URL[i] = a$url |
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
| library(WriteXLS) | |
| # renderedExperience, marketingChannel, allMetrics are data frames | |
| sheetList <-list("Rendered Experience" = renderedExperience, "Marketing Channel" = marketingChannel, "Key Metrics" = allMetrics) | |
| WriteXLS( | |
| x = sheetList, | |
| ExcelFileName = "RenderedExperience-MarketingChannel.xlsx", | |
| SheetNames = names(sheetList), |
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
| library(RSiteCatalyst) | |
| library(dplyr) | |
| library(lubridate) | |
| SCAuth( | |
| "key", | |
| "secret", | |
| "company" | |
| ) |
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
| library(rvest) | |
| url2 = read_html("http://www.verticalmeasures.com/measurement-reporting/google-analytics-101-best-practices-for-ecommerce-websites/") | |
| newxpath = as.character('//*+[contains(concat( " ", @class, " " ), concat( " ", "sidebar-widget", " " ))]//*[contains(concat( " ", @class, " " ), concat( " ", "sidebar-widget", " " ))]//ul') | |
| titles = html_nodes(url2, css = "p") | |
| titles = html_text(titles) | |
| titles |
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
| library(RSiteCatalyst) | |
| library(lubridate) | |
| library(dplyr) | |
| # SCAuth Info ------------------------------------------------------------- | |
| SCAuth(key = "", #fill in with your own info | |
| secret = "", #fill in with your own info | |
| company = "" #fill in with your own info |
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
| sectionName = "word word word"; // The data layer value goes here. Should look like: best western rewards. | |
| sectionNameSplit = sectionName.split(" "); // Split the sectionName into an array -- separator is a space. | |
| for (i = 0; i < sectionNameSplit.length; i++) { | |
| sectionNameSplit[i] = sectionNameSplit[i].substring(0,1).toUpperCase() + sectionNameSplit[i].substring(1,sectionNameSplit[i].length); | |
| } | |
| sectionName = sectionNameSplit.join(" "); // "Word Word Word" stored back in sectionName | |
| // Change sectionName to value being sent to Analytics system from Tealium. |
OlderNewer