'R Studio keeps crashing when I'm trying to merge multiple csv files into a data frame. How do I fix this?
I have 12 csv files that I need to merge for analysis project and their size ranges from 20mb to 120mb per file.
I attempted cutting down to only using the necessary columns by using fread() so it reads 6 columns instead of the total 11.
I've assigned each of them into a data frame as shown below.
However, at some point doing these manually, especially for using View() of the data frame that contains the 12 csv data, I keep getting crashed from R Studio probably due to the memory usage and the whole environment just resets and I have to do everything over again.
Is there a shorting and less ugly way to do this without crashing?
Packages <- c("dplyr", "janitor", "skimr", "readr", "lubridate","tidyverse","tidyr")
lapply(Packages, library, character.only = TRUE)
library("data.table")
td2105 <- fread("/cloud/project/Capstone Cyclistic Project/202105-divvy-tripdata.csv",
select = c("rideable_type", "started_at", "ended_at",
"start_station_name","end_station_name","member_casual"))
td2106 <- fread("/cloud/project/Capstone Cyclistic Project/202106-divvy-tripdata.csv",
select = c("rideable_type", "started_at", "ended_at",
"start_station_name","end_station_name","member_casual"))
td2107 <- fread("/cloud/project/Capstone Cyclistic Project/202107-divvy-tripdata.csv",
select = c("rideable_type", "started_at", "ended_at",
"start_station_name","end_station_name","member_casual"))
td2108 <- fread("/cloud/project/Capstone Cyclistic Project/202108-divvy-tripdata.csv",
select = c("rideable_type", "started_at", "ended_at",
"start_station_name","end_station_name","member_casual"))
td2109 <- fread("/cloud/project/Capstone Cyclistic Project/202109-divvy-tripdata.csv",
select = c("rideable_type", "started_at", "ended_at",
"start_station_name","end_station_name","member_casual"))
td2110 <- fread("/cloud/project/Capstone Cyclistic Project/202110-divvy-tripdata.csv",
select = c("rideable_type", "started_at", "ended_at",
"start_station_name","end_station_name","member_casual"))
td2111 <- fread("/cloud/project/Capstone Cyclistic Project/202111-divvy-tripdata.csv",
select = c("rideable_type", "started_at", "ended_at",
"start_station_name","end_station_name","member_casual"))
td2112 <- fread("/cloud/project/Capstone Cyclistic Project/202112-divvy-tripdata.csv",
select = c("rideable_type", "started_at", "ended_at",
"start_station_name","end_station_name","member_casual"))
td2201 <- fread("/cloud/project/Capstone Cyclistic Project/202201-divvy-tripdata.csv",
select = c("rideable_type", "started_at", "ended_at",
"start_station_name","end_station_name","member_casual"))
td2202 <- fread("/cloud/project/Capstone Cyclistic Project/202202-divvy-tripdata.csv",
select = c("rideable_type", "started_at", "ended_at",
"start_station_name","end_station_name","member_casual"))
td2203 <- fread("/cloud/project/Capstone Cyclistic Project/202203-divvy-tripdata.csv",
select = c("rideable_type", "started_at", "ended_at",
"start_station_name","end_station_name","member_casual"))
td2204 <- fread("/cloud/project/Capstone Cyclistic Project/202204-divvy-tripdata.csv",
select = c("rideable_type", "started_at", "ended_at",
"start_station_name","end_station_name","member_casual"))
td_2105_to_2204 <- rbind(td2105,td2106,td2107,td2108,td2109,td2110,td2111,td2112,td2201,td2202,td2203,td2204)
View(td_2105_to_2204)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
