Member-only story
15 Examples for Data Analysis with R
R makes it quite simple to perform data analysis tasks
Python and R are the two dominant programming languages in the data science ecosystem. Both have many libraries that offer efficient and simple methods to perform data analysis tasks.
In this article, we will focus on the data table package of R. The examples will demonstrate the typical data analysis and manipulation tasks on tabular data.
We will do the examples on the Melbourne housing dataset available on Kaggle. I created a data table that contains a subset of columns from this dataset. The fread function can be used to read a csv file and create a data table.
> melb <- fread("Downloads/melb_data.csv")
> names(melb)
The names function can be used to view the column names. It is quite similar to the column method of Pandas library.
Example 1
We can select a subset of columns from a data table by passing the coluımn indices.
> DT <- melb[, c(1,2,3,4,5)]
> head(DT)