Statinfer

103.2.8 Exporting Data

In previous post we saw  An Example of Merge and Join

Writing data in CSV file

Another important feature available in R is the export function. With this function, the data created in R can be saved into any other format like the csv, xlsx, etc. Just as we used the function read.csv() to read the contents of the CSV file into R, there is a function called write.csv(), using which the data compiled can be exported to other formats. The syntax for export is shown below:

>all_customer<-merge(Bills_unique,Complaints_unique,by="cust_id",all=TRUE)
>write.csv(all_customer, "C:\\Users\\venk\\Desktop\\Temp\\all_customer.csv")

It is important to give the correct path before executing, as this may throw an exception.

Writing data in txt file

Data in R can also be saved in the text files. The syntax is shown below

>all_customer<-merge(Bills_unique,Complaints_unique,by=”cust_id”,all=TRUE)
>write.table(all_customer,”C:\\Users\\venk\\Desktop\\Temp\\all_customer.txt”, sep=”\t”)

The above code saves the data from all_customer data in the form of test file into ‘all_customer.txt’, to the path specified in the code.

In this session we discussed data importing from various sources. We learned some basic commands to work with data. We also learned to manipulate the datasets, creating new variables, sorting the data sets, handling duplicates, merging and joining the datasets, etc. There data handling techniques are very important for data analysis.

 

24th January 2017

0 responses on "103.2.8 Exporting Data"

Leave a Message

Blog Posts

Hurry up!!!

"use coupon code for FLAT 30% discount"  datascientistoffer        ___________________________________      Subscribe to our youtube channel. Get access to video tutorials.                

Contact Us

Statinfer Software Solutions#647 2nd floor 1st Main, Indira Nagar 1st Stage, 100 feet road,Indranagar Bangalore,Karnataka, Pin code:-560038 Landmarks: Opp. Namma Metro Pillar 48.

Connect with us

linkin fn twitter g

How to become a Data Scientist.?

top