Skip to content

Testing R Markdown with R Studio and posting it on

Today R Studio has announced, a new platform to publish an R Markdown document in html format.

It seems that RStudio is a very fast growing IDE for not only data analysis in R but also for reproducible report in PDF and HTML using R and knitr package.

I then tried to create an R Markdown file  with R Studio for my recent data visualisation for Thai tourist data.

And here is my first published HTML report using R Markdown with RStudio.

The following is the code in the R Markdown file.

Visualising International Tourist Arrival

by **Pairach Piboonrungroj**
email: <>
twitter: [@piboonrungroj](!/Piboonrungroj)

This is a test for an R Markdown document using my analysis of *tourist data of Thailand*.
You may see the original post in [my website](

Tourism is an important sector in the global economy. In many countries, tourism is the main source of revenue, Thailand is one of them. However, tourism sector is a fast moving sector. It is very sensitive to various factors and also vulnerable. The tourism markets for each destination (country) are also very diverse. Tourism data are available and updated frequently. One of the most important report of national tourism statistics; number of tourist arrivals from each country of origin, their average length of stay and total receipt or expenditure. These tourism statistics are important but often reported separately due to the limitation of software used by analysts.

The following are the steps to produce a comprehensive profile of international tourists in Thailand in 2005 with ggplot2 package in R.

### 1: Import data into R
exp05 <- read.csv("", head = T)

### 2: Load 'ggplot2' package for plotting elegant data visualisation

### 3: Specify x and y axis, label, size of the bubbles and colour of the region
```{r fig.width=7, fig.height=6}
exp <- ggplot(exp05, aes(x=number, y=length, label=country, size=receipt, colour = region))

### 4: Create a plot and add texts to x and y axis
```{r fig.width=11, fig.height=6}
exp + geom_point() + geom_text(hjust=0.7, vjust=2) + labs(x = "Number of Tourist Arrivals", y = "Length of Stay (days)") + scale_area("Receipt (M. USD)") + scale_colour_hue("Region")
One Comment Post a comment

Trackbacks & Pingbacks

  1. R Style Guide | Pairach Piboonrungroj

Leave a Reply

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

You are commenting using your 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 )

Connecting to %s

%d bloggers like this: