I’m a R beginner and having difficulty with the bike sharing capstone project: I have the following code chunks:

I can't figure out where the problem is, but i don't have values on my "MIN' and i still have "NA" on my graph after using some codes like na.mit() and drop_na, While going through other people's project i notice they have values on their "MIN", pictures and code chunks are slated below:

aggregate(all_trips_v2$ride_length ~ all_trips_v2$member_casual, FUN = mean)
aggregate(all_trips_v2$ride_length ~ all_trips_v2$member_casual, FUN = median)
aggregate(all_trips_v2$ride_length ~ all_trips_v2$member_casual, FUN = max)
aggregate(all_trips_v2$ride_length ~ all_trips_v2$member_casual, FUN = min)
all_trips_v2 %>% 
  mutate(weekday = wday(started_at, label = TRUE)) %>% 
  group_by(member_casual, weekday) %>% 
  summarise(number_of_rides = n(),average_duration = mean(ride_length)) %>% 

all 4 functions you mention have na.rm parameters ; which if set to TRUE would have them ignore NA values
or like you say you could na.omit() over your data.frame and then do the calculation; you've show no sign of having done this; so we can't comment on if you have done it incorrectly. If you did do it did you remember to assign the result back to a name with <-

1 Like

After that i tried with the codes: na.mit() and drop_na, and got same results.

Hi @innocent_sky, try to put a reproducible example of data.

Maybe you could put the file in a drive or other type.

1 Like

its not na.mit() it would be na.omit()

I am afraid i don't know how to load the data in here, however the datasets is very big, it's Cyclistic’s_Trips_Data data frame head (Cyclistic's_Trip_Data)#> ride_id, rideable_type, started_at, ended_at, start_station_name, start_station_id, end_station_name, end_station_id, member_casual, ride_length, day_of_week,#> 12 months data frame from 2022_01_01 to 2022_12_12.

My bad it's typo error, na.omit() is what i did and the NAs are still there.

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.