• No products in the cart.

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.

 

20th June 2017

DV Analytics

DV Data & Analytics is a leading data science,  Cyber Security training and consulting firm, led by industry experts. We are aiming to train and prepare resources to acquire the most in-demand data science job opportunities in India and abroad.

Bangalore Center

DV Data & Analytics Bangalore Private Limited
#52, 2nd Floor:
Malleshpalya Maruthinagar Bengaluru.
Bangalore 560075
India
(+91) 9019 030 033 (+91) 8095 881 188
Email: info@dvanalyticsmds.com

Bhubneshwar Center

DV Data & Analytics Private Limited Bhubaneswar
Plot No A/7 :
Adjacent to Maharaja Cine Complex, Bhoinagar, Acharya Vihar
Bhubaneswar 751022
(+91) 8095 881 188 (+91) 8249 430 414
Email: info@dvanalyticsmds.com

top
© 2020. All Rights Reserved.