February 23, 2014

TokyoR, 22 February 2014

On 22 February 2014, I attended the 36th Tokyo R user group meeting (TokyoR). It was a very good turn out with about 50 attendees at the NIFTY Corporation's office in Shinjuku Tokyo.
The session started at 14:30 with six presentations and five lightning talks, followed by drinks.

Presentations
This meeting were presented in Japanese. So, I named English titles for them.

1. Learn R in 10 minutes
The first presentation was given by Nobuaki Ooshiro from Yahoo Japan. He presented "Learn R in 10 minutes" . That was very useful introduction to R.

2. An introduction to statistical power
Takashi J. Ozaki, who is famous for his blog "Data Scientist in Ginza, Tokyo", gave an insightful talk about statistical power. For data scientist wannabies, it is important to understand the concept of statistical power. He made a supplementary about his talk in his blog.

3. Reproducible research with Rmarkdown, knitr and Pandoc
@teramonagi talked about reproducible research. With Rmarkdown, knitr and Pandoc, he presented how to make reports. It was a very useful reference about reporting with R.

4. Visualization with tSNE and SPADE
@Med_KU showed the method of dimensionality reduction and visualization with two packages, tSNE and SPADE. By the method, he visualized features of anime characters. Sorry, because I'm not good at anime, I can not say that I fully understood his presentation. But I understand his enthusiasm!!! Also, he said that he is writing an e-book for data mining.

5. EasyHTMLReport makes your reporting life happier
Yohei Sato introduced his package EasyHTMLReport. This package enables us to send HTML reporting mail from R. You don't have to sweat to make a report any more. Excellent package!!!

6. Discrete choice models with R
Hiroki Sano, who works as a data scientist at Accenture, gave a talk about discrete choice models. When you works in marketing research, you can not avoid discrete choice models. He taught the mechanism of discrete choice models and how to apply it with mlogit package.

Lighting talks
After six presentations, five lightning talks were given. In only 5 minutes, all presenters talked about impressive contents.
I just list titles below. For more details, please check out slides.



Next Tokyo R
Next meeting is scheduled for 29 March.
Thanks to NIFTY Corporation for hosting the event.

Food diary with rCharts and Google drive

Food diary with rCharts and Google drive I'm interested in not only global issues, but also personal issues, especially health issues.
Since last week, I have kept a food diary in spreadsheet of Google drive.
Here is a plot of Food frequency and average energy for a week.

Code

library(dplyr)
library(RCurl)
library(rCharts)

# read data from Google Drive

s <- "https://docs.google.com/spreadsheet/pub?key=0AroiXQuUrfhwdG0zUE9LbTFvQ3hQNUx5bk5tMEtPaGc&output=csv"
x <- getURL(s, ssl.verifypeer = FALSE, .encoding = "UTF-8")
mydata <- read.csv(text = x, as.is = TRUE)

# data cleaning

mydata$energy <- as.numeric(mydata$energy)
mydata_summary_food <- mydata %.% group_by(food_en) %.% summarise(avg = mean(energy), 
    freq = n(), size = 7)

# visualize

h1 <- hPlot(x = "freq", y = "avg", data = mydata_summary_food, type = "bubble", 
    group = "food_en", size = "size")
h1$show("iframesrc", cdn = TRUE)

February 21, 2014

Electrical devices import in Japan

Why vis this?

I heard that import of Japan is increasing in the field of electrical devices (smartphones, solar panels and so on).

I decided to check the actual data and see whether is it true or not.

Trade of Statistics in Japan has a dataset that fits it perfectly

http://www.customs.go.jp/toukei/info/tsdl.htm

Here's the plot(Y axis: JPY1000000). As statistics of electrical devices, I used the "Computers and units" and "Telephony".

So what?

Electrical device imports, surely, has increased in two years. Exports, in contrast to, is on the downward trend.

Where does Japan import devices from? USA? EU? Asia?

Next time, I will check the region.

Code

library(rCharts)
dtrade <- read.csv("http://dl.dropboxusercontent.com/u/956851/dtrade.csv", as.is = TRUE)
dtrade$date <- as.Date(dtrade$date)
dtrade$value <- trunc(as.numeric(dtrade$value)/1000)
n1 <- nPlot(data = dtrade, x = "date", y = "value", group = "var", type = "lineChart")
n1$xAxis(tickFormat = "#!function(d) {return d3.time.format('%Y-%b')(new Date( d * 86400000 ));}!#", 
    axisLabel = "date")
n1$show("iframesrc", cdn = TRUE)