combining data into a single data frame

Good afternoon, I'm sort of stuck on a case study I'm currently working on. I had to download 12 csv files which each contains large amounts of data. I need to combine the data into a single data frame. I'm not sure if I should use SQL, R studio or python to execute this task. I already attempted this with R studio, but I kept getting errors. I feel that I'm skipping a step. I just don't know what it is. If anyone can help me I'd greatly appreciate it!

I'm assuming you want to combine the data row-wise. If all the data frames have the same column names and types, this is easily done with the rbind() function. Here is a toy example.

DF1 <- data.frame(A = 1:3, B = 11:13)
DF1
#>   A  B
#> 1 1 11
#> 2 2 12
#> 3 3 13

DF2 <- data.frame(A = 21:23, B = 31:33)
DF2
#>    A  B
#> 1 21 31
#> 2 22 32
#> 3 23 33

DF3 <- rbind(DF1, DF2)
DF3
#>    A  B
#> 1  1 11
#> 2  2 12
#> 3  3 13
#> 4 21 31
#> 5 22 32
#> 6 23 33

Created on 2023-06-08 with reprex v2.0.2

If you want to combine them column-wise, that can also be done but you will need to explain how the rows are matched.

1 Like

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.