Read data from various csv and store it in one dataframe

0 votes
Hi, How to store data from multiple Excel sheets and store it in a single dataframe. The sheets contains the same structure i.e columns with same or different number of records. The sheets contain details of products, sales, orders, etc of different branches of a store.
Jul 2 in Data Analytics by piyush
22 views

1 answer to this question.

0 votes

Use rbind() to join both data frames into one data frame.

Read both the sheets in separate data frames.-

Then use rbind() like below- for example i used global siperstore.xlsx file

>  library(openxlsx)
> data_sheet1 = read.xlsx("C:\\Users\\Cherukuri_Sindhu\\Downloads\\global_superstore_2016.xlsx",sheet = 1)
> data_sheet2 = read.xlsx("C:\\Users\\Cherukuri_Sindhu\\Downloads\\global_superstore_2016.xlsx",sheet = 2)
> final_dataframe = rbind(data_sheet1,data_sheet2)

Make sure to have same number of columns of both sheets else below error would pop up - 

I used the same sheet with the first 6 rows and last 6 rows in different data frames to combine them in a new data frame

Hope it helps you.

answered Jul 4 by anonymous
• 25,900 points

Related Questions In Data Analytics

0 votes
0 answers

Split a string and store it in multiple columns from a field in R

How to Split a string and store ...READ MORE

Jun 28 in Data Analytics by Anand
32 views
0 votes
1 answer

Read table from webpage and convert it into dataframe

Hi Kalyan, Use html_table to create tables from ...READ MORE

answered 5 days ago in Data Analytics by prajwal
9 views
0 votes
1 answer

How to calculate group mean and assign it to new data in R

You can use something like this: df$grp.mean.values <- ...READ MORE

answered Jun 27, 2018 in Data Analytics by darklord
• 6,140 points
46 views
0 votes
2 answers

"Train" and "Test" sets in Data Science

Normally to perform supervised learning you need ...READ MORE

answered Aug 2, 2018 in Data Analytics by Anmol
• 3,620 points
43 views
0 votes
1 answer

By using dpylr package sum of multiple columns

Basically here we are making an equation ...READ MORE

answered Apr 5, 2018 in Data Analytics by DeepCoder786
• 1,700 points
98 views
0 votes
1 answer

How to convert a text mining termDocumentMatrix into excel or csv in R?

By assuming that all the values are ...READ MORE

answered Apr 5, 2018 in Data Analytics by DeepCoder786
• 1,700 points
118 views
0 votes
1 answer

In a dpylr pipline how to use sample and seq?

For avoiding rowwise(), I prefer to use ...READ MORE

answered Apr 6, 2018 in Data Analytics by DeepCoder786
• 1,700 points
76 views
0 votes
1 answer

How to create a list of Data frames?

Basically all we have to do is ...READ MORE

answered Apr 9, 2018 in Data Analytics by DeepCoder786
• 1,700 points
70 views
0 votes
1 answer

Read from database and store in R as dataframe

Your code would fetch you a MySQL ...READ MORE

answered Jul 29 in Data Analytics by anonymous
• 25,900 points
26 views
0 votes
1 answer

Store a built in dataset or dataframe from R to database

dbWriteTable() function allows you to store data ...READ MORE

answered Jul 29 in Data Analytics by anonymous
• 25,900 points
19 views