It is common that data format extracted from clinical database does not meet the purpose of statistical analysis. In clinical research, variables are frequently measured repeatedly over the follow-up period. Such data can be displayed either in wide or long format. Transformation between these 2 forms can be challenging by hand. Fortunately, there are sophisticated packages in R environment. Data frame should firstly be melted and then casted to format that you want. Aggregation over unique combination of id variables is also allowable. Additionally, the article also introduces 2 functions colsplit() and funstofun() that can be useful in some circumstances.