#testing rows in QueueRanked Batch
library(RSiteCatalyst)
SCAuth("ruser:DSG", "606617aa72ed1b3be4eee72ecfad9bc0")
argList <- list(
reportsuite.id = "dsgusprd",
date.from = "2018-05-13",
date.to = "2018-05-13",
metrics = "visits",
elements = "evar2",
segment.id = "537d515de4b0893ab3064e73",
batchBy = "rows",
batchLength = 10000,
rows = 150000
)
dat <- do.call(QueueRankedBatch, argList)
#demo of createLog and editLog
createLog(c("env", "date.run", "result"))
editLog("env", "matts computer")
editLog("date.run", "today")
editLog("result", "good", write = T, logDir = getwd())
#adding a new log
editLog("env", "matts computer")
editLog("date.run", "tomorrow")
editLog("result", "bad", write = T, logDir = getwd())
#you can check the WD that the log was there and written correctly
unlink(paste0(getwd(), "/log.csv"))
#callSQL tests
check <- callSQL("select * from ecom_dim.date_dim where rownum < 5",
db = "ecomp", username = username, password = password)
check <- callSQL("select * from ecom_dim.date_dim where fiscal_month_name = 'November'",
db = "ecomp", username = username, password = password)
#testing FTP functions
host <- "ftp.omniture.com/DKSLibTest/"
userpwd <- adobeUserPwd <- "DSG:Vo$p$P1T"
stringSearch <- "FnS"
fileType <- ".zip"
pattern <- "FnS"
tempPath <- ""
ftpType <- "FTP"
#testing get.
fileList <- getFTPFileList(host, adobeUserPwd, stringSearch, fileType)
st <- Sys.time()
check1 <- getFTPFiles(host, userpwd, ftpType, fileList, pattern, tempPath)
et <- Sys.time()
tot.read <- et - st
#test just getting a file name and complete path
file <- "allData.csv"
tempPath <- "X:/"
st <- Sys.time()
writeFTPFiles(host, adobeUserPwd, fileList, file, tempPath)
et <- Sys.time()
tot.write <- et - st
#test null temp path.
tempPath <- NULL
writeFTPFiles(host, adobeUserPwd, fileList, file)
#test for dummy variable function.
df <- data.frame(V1 = factor(rep(c("A","B"), 5)),
V2 = factor(rep(c("C","D","E","F","G"), 2), ordered = T),
ID = 1:10)
dummy(df, c("V1"))
dummy(df, c("V2"))
dummy(df, c("V1","V2"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.