Hi!
I need to convert the WLTP and stop column to numeric, but struggling since there are more than numbers there. Any suggestions how I will do it?
Code so far, need to plot this for an assignment.
library(tidyverse)
library(rvest)
library(XML)
library(ggrepel)
library(ggeasy)
cars <- read_html("https://www.motor.no/aktuelt/motors-store-vintertest-av-rekkevidde-pa-elbiler/217132")
tables <- cars %>% html_table(fill=TRUE)
cartable <- tables[[1]]
cartable <- cartable[-1,]
colnames(cartable) <- c("Modell (temp. varierte fra 0° til -10°)", "WLTP", "stop", "Avvik")
# Lager plottet
plot1 <- cartable %>%
ggplot(aes(x = `WLTP-tall`, y = STOPP)) +
geom_point() +
scale_y_continuous(breaks = seq(from=200, to=600, by=100)) +
scale_x_continuous(breaks = seq(from=200, to=600, by=100)) +
labs(x= "WLTP",
y= "STOPP") +
theme_gray()
plot1