Split data text into columns in R

Hello there, I need your help. I was working with different data framed as in the photo attached

which contained 13 variables

I needed to combine all data set and so I used the formula:
#Combine all the data sets
all_year_tripdata <- bind_rows(divvy_tripdata_2022_04, divvy_tripdata_2022_05, divvy_tripdata_2022_06, divvy_tripdata_2022_07, divvy_tripdata_2022_08, divvy_tripdata_2022_09, divvy_tripdata_2022_10, divvy_tripdata_2022_11, divvy_tripdata_2022_12, divvy_tripdata_2023_01, divvy_tripdata_2023_02, divvy_tripdata_2023_03, divvy_tripdata_2023_04)

this created a text file all_year_tripdata but as a text rather than keeping the existing frame of the other datasets, like a csv file , and delimited by a "."

I need to split the text into the columns and frame that I had before I combined all the datasets, and so in:
[1] "ride_id"
[2] "rideable_type"
[3] "started_at"
[4] "ended_at"
[5] "ride_length" (I have added this one with the formula all_year_tripdata$ride_length <- difftime(all_year_tripdata$ended_at,all_year_tripdata$started_at)
[6] "start_station_name"
[7] "start_station_id"
[8] "end_station_name"
[9] "end_station_id"
[10] "start_lat"
[11] "start_lng"
[12] "end_lat"
[13] "end_lng"
[14] "member_casual"

without delimiter "

Can please anyone help me? and could you please tell me what I have done wrong? why when I combined all the dataset, the frame was no kept?

Thanks a lot

Hi @masato
It seems that your first “ divvy_tripdata_” file did not import correctly as that dataframe only has 1 variable not 13 like all the others.

1 Like

This topic was automatically closed 21 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.