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, 2019 in Data Analytics by piyush
428 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, 2019 by anonymous
• 33,030 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 29, 2019 in Data Analytics by Anand
720 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, 2019 in Data Analytics by prajwal
1,352 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 Sahiti
• 6,370 points
1,531 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 14, 2019 in Data Analytics by anonymous
• 33,030 points
2,920 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
1,993 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
1,604 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

edited Jun 9, 2020 by Gitika 891 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
994 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 30, 2019 in Data Analytics by anonymous
• 33,030 points
852 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 30, 2019 in Data Analytics by anonymous
• 33,030 points
792 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP