Skip to content

Instantly share code, notes, and snippets.

@randyzwitch
Created September 7, 2014 00:31
Show Gist options
  • Save randyzwitch/5c74a1f1c763706d749b to your computer and use it in GitHub Desktop.
Save randyzwitch/5c74a1f1c763706d749b to your computer and use it in GitHub Desktop.
Simple Graph of RSiteCatalyst pathing data
#Optional step: Cleaning my pagename URLs to remove to domain for graph clarity
queue_pathing_pages$step.1 <- sub("http://randyzwitch.com/","",
queue_pathing_pages$step.1, ignore.case = TRUE)
queue_pathing_pages$step.2 <- sub("http://randyzwitch.com/","",
queue_pathing_pages$step.2, ignore.case = TRUE)
#### Remove Enter and Exit site values
#This information is important for analysis, but not related to website structure
graph_links <- subset(queue_pathing_pages, step.1 != "Entered Site" & step.2 != "Exited Site")
#### First pass - Simple Network
# Setting standAlone = TRUE creates a full HTML file to view graph
# Set equal to FALSE to just get the d3 JavaScript
simpleoutput1 = "C:/Users/rzwitc200/Desktop/simpleoutput1.html"
d3SimpleNetwork(graph_links, Source = "step.1", Target = "step.2", height = 600,
width = 750, fontsize = 12, linkDistance = 50, charge = -50,
linkColour = "#666", nodeColour = "#3182bd",
nodeClickColour = "#E34A33", textColour = "#3182bd", opacity = 0.6,
standAlone = TRUE, file = simpleoutput1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment