Blog Posts by Andrew B. Collier / @datawookie


Day 17: Datasets from R

Month of Julia
Accessing R Datasets from Julia.

R has an extensive range of builtin datasets, which are useful for experimenting with the language. The RDatasets package makes many of these available within Julia. We’ll see another way of accessing R’s datasets in a couple of days’ time too. In the meantime though, check out the documentation for RDatasets and then read on below.

Read More →

urlshorteneR: A package for shortening URLs

This is a small package I put together quickly to satisfy an immediate need: generating abbreviated URLs in R. As it happens I require this functionality in a couple of projects, so it made sense to have a package to handle the details. It’s not perfect but it does the job. The code is available from GitHub along with vague usage information.

In essence the functionality is simple: first authenticate to shortening service (goo.gl and Bitly are supported at present) then shorten or expand URLs as required. The {longurl} package will perform the latter function too, possibly with greater efficiency.

Read More →

Day 12: Parallel Processing

Month of Julia
Doing Parallel Processing with Julia.

The previous post looked at metaprogramming in Julia, considering how to write code that will generate or modify other code. Today’s post considers a somewhat less esoteric, yet powerful topic: Parallel processing.

As opposed to many other languages, where parallel computing is bolted on as an afterthought, Julia was designed from the start with parallel computing in mind. It has a number of native features which lend themselves to efficient implementation of parallel algorithms. It also has packages which facilitate cluster computing (using MPI, for example). We won’t be looking at those, but focusing instead on coroutines, generic parallel processing and parallel loops.

Read More →

Day 9: Input/Output

Month of Julia

Your code won’t be terribly interesting without ways of getting data in and out. Ways to do that with Julia will be the subject of today’s post.

Console IO

Direct output to the Julia terminal is done via print() and println(), where the latter appends a newline to the output.

julia> print(3, " blind "); print("mice!\n")
3 blind mice!
julia> println("Hello World!")
Hello World!

Terminal input is something that I never do, but it’s certainly possible. readline() will read keyboard input until the first newline.

Read More →

Day 3: Variables and Data Types

Month of Julia

The previous post considered a selection of development environments for working with Julia. Now we’re going to look at a topic which is central to almost every programming task: variables.

Most coding involves the assignment and manipulation of variables. Julia is dynamically typed, which means that you don’t need to declare explicitly a variable’s data type. It also means that a single variable name can be associated with different data types at various times. Julia has a sophisticated, yet extremely flexible, system for dealing with data types. covered in great detail by the official documentation. My notes below simply highlight some salient points I uncovered while digging around.

Read More →

Day 1: Installation and Orientation

Month of Julia

As a long-term R user I’ve found that there are few tasks (analytical or otherwise) that R cannot immediately handle. Or be made to handle after a bit of hacking! However, I’m always interested in learning new tools. A month or so ago I attended a talk entitled Julia’s Approach to Open Source Machine Learning by John Myles White at ICML in Lille, France. What John told us about Julia was impressive and intriguing. I felt compelled to take a closer look. Like most research tasks, my first stop was the Wikipedia entry, which was suitably informative.

Read More →