Skip to content

Instantly share code, notes, and snippets.

Randy Zwitch randyzwitch

Block or report user

Report or block randyzwitch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@randyzwitch
randyzwitch / rsitecatalyst-search.R
Created Feb 4, 2014
Examples of Search functionality for RSiteCatalyst v1.3
View rsitecatalyst-search.R
#Top 100 Pages where the pagename starts with "Categories"
#Uses searchKW argument
queue_ranked_pages_search <- QueueRanked("production",
"2013-01-01",
"2014-01-28",
c("pageviews", "visits"),
"page",
top = "100",
searchKW = "^Categories"
)
@randyzwitch
randyzwitch / rsitecatalyst-variable-timing.R
Created Feb 4, 2014
Example of variable timing on a request call
View rsitecatalyst-variable-timing.R
#Change timing of function call
#Wait 30 seconds between attempts to retrieve the report, try 5 times
queue_overtime_visits_pv_day_social_anomaly2 <- QueueOvertime("production",
"2013-01-01",
"2014-01-28",
c("visits", "pageviews"),
"day",
"Visit_Social",
anomalyDetection = "1",
currentData = "1",
View array_custom_types
#Twitter response comes back as string
#Use JSON.jl to make into a Dict
#Create a custom type from Dict, in this case TWEETS
#Want to define a DataFrame method DataFrame(response::Array{TWEETS,1})
20-element Array{TWEETS,1}:
TWEETS(nothing,nothing,"Thu Mar 06 17:19:12 +0000 2014",nothing,["symbols"=>{},"user_mentions"=>{["screen_name"=>"randyzwitch","id_str"=>"98689850","id"=>98689850,"name"=>"Randy Zwitch","indices"=>{0,12}]},"hashtags"=>{},"urls"=>{}],0,false,nothing,441624046657355777,"441624046657355777","randyzwitch",441623445286436864,"441623445286436864",98689850,"98689850","en",nothing,nothing,nothing,1,true,nothing,"<a href=\"http://janetter.net/\" rel=\"nofollow\">Janetter</a>","@randyzwitch the R gods demand sacrifice!!!!!!!!!!!!!!!",false,["screen_name"=>"Randy_Au","profile_use_background_image"=>true,"id_str"=>"148398537","utc_offset"=>nothing,"listed_count"=>7,"profile_sidebar_border_color"=>"C0DEED","profile_image_url"=>"http://pbs.twimg.com/profile_images/2751420418/7f1ff3346d047d82ca93b9413
@randyzwitch
randyzwitch / composite-df.jl
Created Mar 7, 2014
DataFrame method on composite type
View composite-df.jl
function DataFrame(array::Array{TWEETS, 1})
#Empty df as container for results
resultdf = DataFrame()
#Get array of field names as symbols from composite type
cols = names(TWEETS)
#For each field in composite type...
for column in cols
@randyzwitch
randyzwitch / realtime-element.R
Created Mar 10, 2014
RSiteCatalyst GetRealTimeReport - Element
View realtime-element.R
GetRealTimeReport("mlcpwmproduction",
"instances",
"page",
periodMinutes = "9",
periodCount = "3")
@randyzwitch
randyzwitch / getrealtime.R
Created Mar 10, 2014
RSiteCatalyst Realtime reports
View getrealtime.R
#Get Real-Time reports that already set up
realtime_reports <- GetRealTimeConfiguration("<reportsuite>")
@randyzwitch
randyzwitch / realtime-overtime.R
Created Mar 10, 2014
RSiteCatalyst GetRealTimeReport - Minimal example
View realtime-overtime.R
GetRealTimeReport("<report suite>", "instances")
@randyzwitch
randyzwitch / realtime-offset.R
Last active Aug 29, 2015
RSiteCatalyst GetRealTimeReport - Offsets
View realtime-offset.R
GetRealTimeReport("<report suite>",
"instances",
periodMinutes = "5",
periodCount = "12",
periodOffset = "10")
@randyzwitch
randyzwitch / saverealtime.R
Created Mar 10, 2014
RSiteCatalyst SaveRealTimeConfiguration
View saverealtime.R
SaveRealTimeConfiguration("<report suite>",
metric1 = "instances",
elements1 = c("page", "referringdomain", "sitesection"),
metric2 = "revenue",
elements2 = c("referringdomain", "sitesection")
metric3 = "orders",
elements3 = c("products")
)
@randyzwitch
randyzwitch / r-json-sprintf.R
Created May 13, 2014
R JSON sprintf example
View r-json-sprintf.R
elements_list = sprintf('{"id":"%s",
"top": "%s",
"startingWith":"%s",
"search":{"type":"%s", "keywords":[%s]}
}', element, top, startingWith, searchType, searchKW2)
You can’t perform that action at this time.