For Homework #2, I ask the students to create a demand generation plan for a real business. This project includes both paid and non-paid methods of demand generation. These are the example slides.
Note that jtools package has plotting capabilities for interactions that include a continuous variable, and categorical x categorical interactions.
Saving graphs without losing any resolution
Rather than using Rstudio’s output options (copy, save, etc.), you can use ggsave to format them how you want and avoid jagged lines. This works with ggplot2.
ggsave("plot.png", width = 6.5, height = 4, units = "in", dpi = 300)
Formatting tables and charts more scientifically
It’s painful to do, but sometimes you have to get rid of all of the default ggplot2 chart stuff to make it simpler and more black and white friendly.
theme_bw()+ theme(panel.grid.major=element_blank(), panel.grid.minor=element_blank(), panel.border=element_blank(), axis.line=element_line() )
And you can make your trendline black:
And you can make your lines different line types rather than using different colors of lines.
You can also have full control over your y-axis:
scale_y_continuous(breaks = c("0%"=0,"10%"=.1,"20%" = 0.2, "30%"=.3,"40%"=.4,"50%"=.5,"60%"=.6,"70%"=.7, "80%"=.8,"90%"=.9,"100%"=1), expand=c(0,0), limits=c(.2,.65)) +
In the code above, I’ve changed .1 to 10% on the axis display and I’ve set the y-axis to go from .2 to .65.
So, apparently the antivirus software on my work computer (which I have no control over) is equipped with “real time file system protection.” I don’t really know what that is, but I know that it often prevents me from installing R packages on my machine, which in turn makes it very difficult to get my analysis done. I don’t know how many people have the same problem, but I’m posting it here for my reference.
First of all, I’ve become accustomed to installing packages through R directly, rather than through R Studio, making sure I get the dependencies:
install.packages("packagename", dependencies = TRUE)
So, the problem with the antivirus is that it will block R from moving the package out of the temporary folder. The antivirus doesn’t like the speed at which it is accomplished apparently. The workaround is to edit the package installer:
trace(utils:::unpackPkgZip, edit = TRUE)
In the window that pops up, I change Sys.sleep(0.5) to Sys.sleep(2). It seems to work great if you slow down the installation process. I don’t know why.
A lot of this is just my opinion, but I’ve learned the hard way. I’ve wasted or lost quite a bit of ad money over the years, and I would like to pass on some of the wisdom I’ve gained.
We generally like the tools we’re already familiar with. I have exclusively used WordPress to build websites since 2010. Before that, I built them from scratch in Dreamweaver. I have also extensively used the Genesis framework during this time. The benefit of WordPress is it’s highly customizable and there is a vast library of free and inexpensive plugins. I like Genesis framework because it makes updates easier. Updates don’t break your website layout, and it has a lot of cool extra features that I’ve grown accustomed to, like the columns classes. For hosting, I’ve become a big fan of Siteground over the last year or so.
You can teach digital marketing without coding, but you can’t easily do digital marketing without knowing your way around basic code such as HTML/CSS. This is a quick introduction to HTML for beginners.
You’re welcome to use these slides, but please give credit with a link. Thanks!