knitr::opts_chunk$set(eval = FALSE)
read_utf8("")
chapter_1.zip
library(rvest)
xml <- read_html("https://www.datacamp.com/courses/customer-segmentation-in-python")
suppressMessages(library(tidyverse))
xml %>%
html_nodes(".link-borderless") %>%
html_attr("href") %>%
tail(4) %>%
str_flatten("\n") %>%
clipr::write_clip()
https://assets.datacamp.com/production/repositories/3202/datasets/40378e0b8f88bffddc938f335bc68baa8fdf0b18/chapter_1.zip https://assets.datacamp.com/production/repositories/3202/datasets/9c670a495912949de0166c3ce690bad536ccf621/chapter_2.zip https://assets.datacamp.com/production/repositories/3202/datasets/cc496bdfda1d59a462bf7ff3e4117bcd34c76b35/chapter_3.zip https://assets.datacamp.com/production/repositories/3202/datasets/eb6a32ed7e5faa4c4b237ab8afb94df55bb4b3a5/chapter_4.zip
todo 下载好 aria2c
迅雷下载成功
list.files("data/",full.names = T,pattern = "zip") %>%
unzip(zipfile = .)
get_data <- function(name = 'chapter_1'){
dir.create(glue("data/{name}"))
unzip(glue("data/{name}.zip"),exdir = glue("data/{name}"))
}
library(glue)
get_data("chapter_1")
get_data("chapter_2")
get_data("chapter_3")
get_data("chapter_4")