© 2018 Proteus. All rights reserved :: Website by Myth

Something old, something new

Something old

This month we've been putting a lot of effort in to building Proteus' social media presence to better connect with people like yourselves, and let them know that we can help them with our statistical consulting service. As part of that, Darryl was going to develop a series of images with classic quotes about data, statistics and the philosophy of science that could be regularly posted out through various social media outlets, but he didn't fancy the idea of putting together 50+ images one at a time. He turned to a programmatic solution using R.

He first trawled the internet to compile a list of suitable quotes, and images of the person reputed to have uttered them. Once compiled, he used the 'magick' R package to create the final images. Below is a snippet of the R code he used, and the image for this post is an example of the result (although we've added an extra caption).

If you want to keep in touch with us via social media, Proteus is now on Facebook, Twitter and LinkedIn, and you can also follow Darryl on ResearchGate. In addition, if you're a previous client of ours, or have attended a workshop we've taught, feel free to leave a Google review about us. Even in the digital age, business development is still about connecting with the people that are interested in your product or service.

library(magick)

# each record in quote_list.txt contains quote, source, name of image file, and an id
quotes<-read.delim("quote_list.txt",stringsAsFactors = FALSE)

# quote image output filename
quotes$outfile<-paste0("quote",quotes$id,".jpg") 

# load Proteus logo and scale to 100 pixels wide
proteus<-image_scale(image_read("/ProteusLogo.jpg"),"100")

for (ii in 1:nrow(quotes)){
  # for each quote load associated image and scale to 300 pixels wide
  image <- image_scale(image_read(quotes$image[ii]), "300")
  
  # get image height
  hgt<-image_info(image)$height

  # define a black background 300 wide and height to match image
  background<-image_blank(width=300,height=hgt,color="black")

  # append image and background side-by-side
  image<-c(image,background)
  image<-image_append(image)

  # define position for logo and add to image
  loc<-paste0("+500+",hgt-38)
  image<-image_composite(image,proteus,offset=loc)

  # format quote, add line break every 25 characters and quote source
  quote<-paste0("\"",quotes$text[ii],"\"")
  quote<-gsub('(.{1,25})(\\s|$)', '\\1\n', quote)
  person<-paste0("-",quotes$source[ii])
  quote<-paste0(quote,person)

  # annotate image with quote text
  image<-image_annotate(image,
                           text=quote,
                           color="white",
                           font="Times",
                           size=20,gravity = "Center",
                           location="+150")

  # save final image as jpeg
  image_write(image,path=quotes$outfile[ii],format="jpeg")
}

Something new

There were a couple of small projects this month that were a bit different to our normal type of jobs that we thought we might highlight.

The first was providing advice to staff at the Otago Regional Council (New Zealand) on the statistical methods they were proposing to summarise and describe water usage as part of their management of resource consents. Water use for commercial (including water bottling) and agricultural purposes is a topic that is coming to the fore in New Zealand. As the 21st century progresses, it is sure to become an increasingly important issue, especially how to best manage the resource in a sustainable and economically viable manner. Of course, there is also the issue of the impacts of domestic usage that many 'city-folk' tend to forget.

In the second project, Davidson Environmental Ltd engaged us to undertake a review of the ongoing monitoring programme they conduct of a marine farm in the Marlborough Sounds (New Zealand), with a focus on the suitability of the monitoring in relation to the constant conditions for the marine farm. Marine farming of salmon, mussels and oysters can be a contentious issue at times, and the inherent variability of the system will often make it difficult to detect an impact of the farm, if any. This is an issue that, in our experience, often tends to be under-appreciated by regulatory groups and agencies when they are issuing consents. Sometimes the statistician is only consulted after the consent conditions are set, which brings us nicely back to the above quote!

 

 

Menu