New Zealand · R

What is orange and been in the news

Carrot prices

http://www.stuff.co.nz/business/90367412/a-kilogram-of-carrots-costs-over-a-dollar-more-than-last-year

Looking at both the raw (so to speak) and seasonally adjusted figures, it looks to me like carrots, as the most extreme difference, got a discussion in the press release, but there is more of a steady upward creep in prices generally. The released figures go to the Fruit and Vegetable level, and no more detail beyond that.

And the code:

library(readxl)
download.file("http://www.stats.govt.nz/~/media/Statistics/Browse%20for%20stats/FoodPriceIndex/HOTPFeb17/fpi-feb17-tables.xlsx", destfile="foodpriceindex.xlsx", mode="wb")
fuit_veg_raw <- read_excel("foodpriceindex.xlsx", sheet = "1", col_names = FALSE, skip = 11)
fuit_veg_seas_adjust <- read_excel("foodpriceindex.xlsx", sheet = "8", col_names = FALSE, skip = 10)
library(tidyr)
fuit_veg_raw <- fill(fuit_veg_raw, X0)[1:37,1:3]
fuit_veg_seas_adjust <- fill(fuit_veg_seas_adjust, X0)[1:37,1:3]
library(lubridate)
fuit_veg_raw$data_date <- seq.Date(from=as.Date("2014-02-01"),
 to=as.Date("2017-02-01"),
 by="month")
fuit_veg_seas_adjust$data_date <- seq.Date(from=as.Date("2014-02-01"), 
 to=as.Date("2017-02-01"),
 by="month")
plot(fuit_veg_raw$data_date, fuit_veg_raw$X2, type="l", ylim=c(1000,1400), main="fruit & veg",
 frame.plot=FALSE, xlab="Date (Feb marked in orange)", ylab="indexed prices")
points(fuit_veg_raw$data_date[fuit_veg_raw$X1=="Feb"], fuit_veg_raw$X2[fuit_veg_raw$X1=="Feb"],
 pch=19, col="orange", cex=0.6)
lines(fuit_veg_seas_adjust$data_date, fuit_veg_seas_adjust$X2, lty=2, col="#00009999")

legend("bottom", legend=c("raw", "seasonally adjusted"), lty=c(1,2),
 col=c("#000000FF", "#00009999"), bty="n")

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s