How do I recreate this graph?

I want to download the R dataset but it is not letting me. Here is everything I have done so far.

BikeSharing1 <- BikeSharing %>%

mutate(season = factor(season, levels =c(1,2,3,4), labels = c("Spring (baseline)", "Summer", "Autumn", "Winter")))

BikeSharing1 <- BikeSharing1 %>%

mutate(holiday = factor(holiday, levels = c(0, 1), labels = c("no", "yes")),

workingday = factor(workingday, levels = c(0, 1), labels = c("no", "yes")))

BikeSharing1 <- BikeSharing1 %>%

mutate(yr = factor(yr, levels=c(0,1), labels=c("2011 (baseline", "2012")))

BikeSharing1 %>%

mutate(weathersit = factor(weathersit, levels =c(1,2,3,4), labels=c("clear (baseline","mist","light precipitation","heavy precipitation")))

rm(t_max,t_min,a_min,a_max,Hum_min, Hum_max, WS_min, WS_max)

bike_data <- BikeSharing1

# Assuming your dataset is loaded into a dataframe called 'bike_data'

# Extract maximum and minimum values from the dataset

temp_min_data <- min(BikeSharing1$temp)

temp_max_data <- max(BikeSharing1$temp)

atemp_min_data <- min(BikeSharing1$atemp)

atemp_max_data <- max(BikeSharing1$atemp)

max_humidity_data <- max(BikeSharing1$hum)

max_windspeed_data <- max(BikeSharing1$windspeed)

# Values from the codebook

temp_min_codebook <- -8

temp_max_codebook <- 39

atemp_min_codebook <- -16

atemp_max_codebook <- 50

max_humidity_codebook <- 100

max_windspeed_codebook <- 67

bike_data <- subset(bike_data, select = -raw_feel_temp_calculated)

# Calculate raw temperature using values from both the codebook and dataset

bike_data$raw_temp_calculated <- (bike_data$temp - temp_min_codebook) / (temp_max_codebook - temp_min_codebook)

bike_data$raw_atemp_calculated <- (bike_data$atemp - atemp_min_codebook) / (atemp_max_codebook - atemp_min_codebook)

remove(raw_feel_temp_calculated)

# Calculate raw humidity using values from both the codebook and dataset

bike_data$raw_humidity_calculated <- bike_data$hum / max_humidity_data

# Calculate raw windspeed using values from both the codebook and dataset

bike_data$raw_windspeed_calculated <- bike_data$windspeed / max_windspeed_data

# Create a new column to check if casual + registered equals cnt

bike_data$sum_matches_cnt <- (bike_data$casual + bike_data$registered) == bike_data$cnt

# Check if all values in the new column are TRUE

all_matches <- all(bike_data$sum_matches_cnt)

# Print the result

if(all_matches) {

print("Values are Equal")

} else {

print("Does not Match")

}

print(all_matches)

bike_data$dteday <- as.Date(bike_data$dteday, format= "%m/%d/%Y")

class(bike_data$dteday)

and the dataset plus codebook

I used the day.csv file at the link you provided to approximately reproduce the plot. I don't see how to convert the temp column in the file to Celsius.

library(tidyverse)
DF <- read.csv("~/R/Play/day.csv")
DF <- DF |> mutate(dteday = mdy(dteday))

ggplot(DF, aes(dteday, cnt, color = temp)) + geom_point()

Created on 2024-01-30 with reprex v2.0.2

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.