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
31 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
• 31,840 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
41 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 Sep 17 in Data Analytics by prajwal
21 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,170 points
58 views
0 votes
1 answer

Create train and test data from dataset in R

Hi, Use sample or sample.split function to create ...READ MORE

answered Oct 13 in Data Analytics by anonymous
• 31,840 points
25 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,720 points
116 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,720 points
159 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,720 points
87 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,720 points
104 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
• 31,840 points
33 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
• 31,840 points
25 views