-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path_massage_data.Rmd
52 lines (36 loc) · 1.04 KB
/
_massage_data.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
title: "transform data to update the URL"
author: "John Little"
date: "`r Sys.Date()`"
output: html_notebook
---
The PowerHouse Museum updated their target website. Thus their "Persistent Links" are no longer accurate for web scraping. They do auto-forward to the new target URL. But, for purposes of the tutorial, I'm updating "Persistent link to the latest URL"
# Load Packages
```{r}
library(tidyverse)
```
# Load Data
```{r}
temp <- read_delim("data/bicycle-subset-phm-collection.tsv",
"\t", escape_double = FALSE, trim_ws = TRUE)
temp
```
# Transform Data
update the link here by creating a new variable, "new_link"
```{r}
new_bicycle_metadata <- temp %>%
mutate(new_link = paste0(
"https://collection.maas.museum/object/",
str_split(`Persistent Link`, "=",
simplify = TRUE)[,2]))
new_bicycle_metadata <- new_bicycle_metadata %>%
select(1:10, 17, everything())
```
# Write data as TSV
```{r}
write_tsv(new_bicycle_metadata, "data/new_url.tsv")
```
# Document Session Info
```{r}
devtools::session_info()
```