R is a programming language widely used for statistical analysis and data visualization, offering a flexible and interactive environment supported by various packages for data cleaning, tidying, and analysis. It is particularly relevant for professionals in mathematics and statistics, including biostatisticians and programmers in the pharmaceutical and biotech industries. R provides a robust array of user-developed packages that can efficiently manipulate complex datasets, such as those based on the Study Data Tabulation Model (SDTM). The popularity of R in data-related fields has surged exponentially over the past decade due to its open-source nature, powerful statistical capabilities, and advanced visualization tools. In this paper, we demonstrate a step-by-step approach to generating an SDTM Demographic (DM) dataset using R. The process leverages R packages such as sas7bdat, tidyverse, haven, parsedate, dplyr, tidyr, and Hmisc. We also provide a detailed procedure for setting up the R environment required for this process. While R has been extensively used for exploratory analysis in the pharmaceutical and biotech industries, its application in creating and analyzing clinical trial datasets, such as SDTM, has been limited. Traditionally, SAS® has been the preferred tool for generating clinical trial datasets. This paper explores R’s potential as a viable alternative, offering enhanced flexibility and cost- effectiveness in clinical trial.