If you believe some people, everything is getting worse1. More so in infosec. For the past few years I listened to many many hours of podcasts, many hours where spent on the weekly show Security Now!. The hosts Steven Gibson and Leo Laporte have been talking about security related news every week over 13 years. Although the content has changed over time, there used to be more explanations but the majority of time is now filled with news, we could use the sentiment in the episodes to see if ‘everything is getting worse’.
[Read More]
Downloading files from a webserver, and failing.
Recently I wanted to download all the transcripts of a podcast (600+ episodes). The transcripts are simple txt files so in a way I am not even ‘web’-scraping but just reading in 600 or so text files which is not really a big deal. I thought.
This post shows you where I went wrong
Also here is a picture I found of scraping.
Webscraping general For every download you ask the server for a file and it returns the file (this is also how you normally browse the web btw, your browser requests the pages).
[Read More]
Writing manuscripts in Rstudio, easy citations
Intro and setup This is a simple explanation of how to write a manuscript in RStudio. Writing a manuscript in RStudio is not ideal, but it has gotten better over time. It is now relatively easy to add citations to documents in RStudio.
**The goal is not think about formatting, and citations, but to write the manuscript and add citations on the fly with a nice visual help. **
[Read More]
Plotting a map with ggplot2, color by tile
Introduction Last week I was playing with creating maps using R and GGPLOT2. As I was learning I realized information about creating maps in ggplot is scattered over the internet. So here I combine all that knowledge. So if something is absolutely wrong/ ridiculous / stupid / slightly off or not clear, contact me or open an issue on the github page.
When you search for plotting examples you will often encounter the packages maps and mapdata.
[Read More]
Submitting your first package to CRAN, my experience
I recently published my first R package to The Comprehensive R Archive Network (CRAN). It was very exciting and also quite easy. Let me walk you through my process.
First a description of my brand new package: badgecreatr, then a description of steps to take for submission.
Package description When you go around github looking at projects you often see these interesting images in the readme
The ones you see above are from ggplot2.
[Read More]
Your most valuable collaborator, future-you
I was recently at a R users meetup where Hadley Wickham talked about data wrangling. He showed some interesting stuff! Did you know that you can put a data frame into a data frame? You can make a list of data frames and add that list to your data frame. Very cool, and more useful then I thought, but that is not what I wanted to talk about.
I would like to give you some tips about working with someone you will probably work with in the future.
[Read More]
Creating a package for your data set
Turning your dataset into a package is very useful for reproducable research. This tutorial is for you, even if you’ve never created a package in r.
Why would you turn your dataset into a package?
very easy to share easy to load (library(name) is easier then load("path/to/file") or data<-read.csv("path/to/file") etc.) documentation is part of the package and will never separate from data attributes of file remain nice and easy introduction to package building What do you need to do to create a dataset package:
[Read More]
Portioning projects
Often we write programs to automate things. The programs range from simple to complex. But in essence, you always do the same thing:
You are trying to solve a problem.
A common pitfall, at least for me, is that you start out to big. What you need to do is start simple and small, and only if your simple thing works, increase the complexity. Separate parts of the program need to be separate functions.
[Read More]