Merging and Cleaning the data using R

R is a suitable option to build out of data oriented problems and create a suitable solution irrespective of your coding or business skills.

While using the tool I always make sure to understand the business requirement, the data orientation and plot my need accordingly.

Here is an example of how you can

1.    Merge two datasets

2.    Remove the unwanted columns of the data

Easy and very useful when you are parsing data or scraping data for building clean data frames.

Merging Data libraries

#code

oldAddr = read.csv(

file=”file1.csv”,

header=TRUE,

sep=”,”

)

newAddr = read.csv(

file=”file2.csv”,

header=TRUE,

sep=”|”

)

Removing the unwanted columns

#code

mydata <- merge(oldAddr, newAddr, by=c(“Name”))

mydata[6:8] <- list(NULL)

write.csv(mydata, “mydata.csv”)

You will find the try data on our Github repository

Feedback and questions are always welcome! Enjoy with R