Good! The next traing task contains data.
You can get the data into R in any way you like, but it will be the easiest in future riddles to read it automatically.
One way to do it is with the rvest package:
library(tidyverse)
library(rvest)
dat <- read_html("https://msf5.neocities.org/rriddle/4913.html") %>%
html_nodes(".data") %>%
html_text() %>%
read_delim(" ") # creates tibble/dataframe from tabular data
Or use this complete function:
library(tidyverse)
library(rvest)
read_rriddle_data <- function(page, table = T) {
dat <- paste0("https://msf5.neocities.org/rriddle/", page, ".html") %>%
read_html() %>%
html_nodes(".data") %>%
html_text() %>%
str_trim()
if(table) dat <- read_delim(dat, " ")
else dat <- str_squish(dat)
return(dat)
}
dat <- read_rriddle_data(4913)
# use table=F if you want to read plain text
Get the data into R and calculate the correlation of x and y. The first 4 decimal places are the solution.
cor(dat$x, dat$y)