i have a little bit of a problem in creating a date format

I created code in my R, but the problem is that my code is not working, I adjusted every details that ight the problem but still the same outcome,
'''
all_trips <- structure(list(ride_id = c("21742460", " 21761461", "21749409"),
started_at = c("1/1/2019 0:24"," 1/4/2019 17:24", "1/3/2019 6:36" ),
ended_at = c("1/1/2019 0:47, " 1/4/2019 17:35", "1/3/2019 6:40" ),
rideable_type = c("5777", "5881", "3545" ),
start_station_id = c(268, 317, 164 ),
start_station_name = c("Lake Shore Dr & North Blvd", "Wood St & Taylor St", "Franklin St & Lake St" ),
end_station_id = c(319, 208, 52 ),
end_station_name = c("Greenview Ave & Diversey Pkwy", "Ashland Ave & 21st St", "Michigan Ave & Lake St" ),
member_casual = c("casual", "member" , "member" ),
date = structure(c(-719143, -719143, -719143 ), class = "Date"),
month = c("01","01", "01"),
day = c("20", "20", "20 ),
year = c("1", "1", "1" ),
day_of_week = c("Tuesday", "Friday","Thursday"),
row.names = c(NA,-3L),
class = c("tbl_df", "tbl", "data.frame"))
'''
So this is the code I wrote but there is some error like this
'''

class = c("tbl_df", "tbl", "data.frame"))
Error: unexpected ')' in "class = c("tbl_df", "tbl", "data.frame"))"
'''
please help me

You have unbalanced parenthesis and quotes.

all_trips <- structure(list(ride_id = c("21742460", " 21761461", "21749409"),
                            started_at = c("1/1/2019 0:24"," 1/4/2019 17:24", "1/3/2019 6:36" ),
                            ended_at = c("1/1/2019 0:47", " 1/4/2019 17:35", "1/3/2019 6:40" ),
rideable_type = c("5777", "5881", "3545" ),
start_station_id = c(268, 317, 164 ),
start_station_name = c("Lake Shore Dr & North Blvd", "Wood St & Taylor St", "Franklin St & Lake St" ),
end_station_id = c(319, 208, 52 ),
end_station_name = c("Greenview Ave & Diversey Pkwy", "Ashland Ave & 21st St", "Michigan Ave & Lake St" ),
member_casual = c("casual", "member" , "member" ),
date = structure(c(-719143, -719143, -719143 ), class = "Date"),
month = c("01","01", "01"),
day = c("20", "20", "20" ),
year = c("1", "1", "1" ),
day_of_week = c("Tuesday", "Friday","Thursday"),
row.names = c(NA,-3L),
class = c("tbl_df", "tbl", "data.frame")))

I know man,I fix that earlier and still my code still dont work

@meztez is right. You had missing quotes and unmatched parentheses. Here is a corrected version with comments on what was wrong.

all_trips <- structure(list(ride_id = c("21742460", " 21761461", "21749409"),
                            started_at = c("1/1/2019 0:24"," 1/4/2019 17:24", "1/3/2019 6:36" ),
                            ended_at = c("1/1/2019 0:47", " 1/4/2019 17:35", "1/3/2019 6:40" ), #missing quote after 0:47
rideable_type = c("5777", "5881", "3545" ),
start_station_id = c(268, 317, 164 ),
start_station_name = c("Lake Shore Dr & North Blvd", "Wood St & Taylor St", "Franklin St & Lake St" ),
end_station_id = c(319, 208, 52 ),
end_station_name = c("Greenview Ave & Diversey Pkwy", "Ashland Ave & 21st St", "Michigan Ave & Lake St" ),
member_casual = c("casual", "member" , "member" ),
date = structure(c(-719143, -719143, -719143 ), class = "Date"),
month = c("01","01", "01"),
day = c("20", "20", "20"),#missing quote here on last "20
                            year = c("1", "1", "1" ),
                            day_of_week = c("Tuesday", "Friday","Thursday")), #missing quote after "Thursday")
                            row.names = c(NA,-3L),
                            class = c("tbl_df", "tbl", "data.frame"))

I already edited it

'''
all_trips <- structure(list(ride_id = c("21742460", "21749409","21761461"),
started_at = c("1/1/2019 0:24","1/3/2019 6:36","1/4/2019 17:24"),
ended_at = c("1/1/2019 0:47,"1/3/2019 6:40","1/4/2019 17:35"),
rideable_type = c("5777","3545","5881"),
start_station_id = c(268,164,317),
start_station_name = c("Lake Shore Dr & North Blvd","Franklin St & Lake St","Wood St & Taylor St"),
end_station_id = c(319,52,208),
end_station_name = c("Greenview Ave & Diversey Pkwy","Michigan Ave & Lake St","Ashland Ave & 21st St"),
member_casual = c("casual","member","member"),
date = structure(c(-719143, -719143, -719143 ), class = "Date"),
month = c("01","01", "01"),
day = c("01", "03","04"),
year = c("1","1","1"),
day_of_week = c("Tuesday","Wednesday","Thursday"),
row.names = c(NA,-3L),
class = c("tbl_df","tbl","data.frame"))

'''

The code you just posted does not run. The code I posted does run and has comments explaining what I fixed. Read those comments.

my bad , Im sorry the code run smoothly thank youuu

It works and I can create ggplot too, thank very much for helpppp

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