从区域标记的单元格中提取文本
Extract text from cells marked by regions
我不知道如何描述这个问题。我为有史以来最模糊的标题道歉。
这就是数据的样子
[us]Deftek
[jp]<U+306F><U+3061><U+307F><U+3064> (Honey)
Hampern
[jp]<U+3067><U+3055><U+3093><U+3068> (Descente)
[jp]<U+5E73><U+30DC><U+30E0> (Hirabomb)
[jp]<U+30A2><U+30AD><U+30E9> (Akira)
Balls Out
[jp]Teguru
[jp]Melty
因此名称 Hampern 和 Balls Out 提取得很好,但其他名称我无法提取任何内容。
library(httr)
library(tidyverse)
library(jsonlite)
fromJSON(rawToChar(GET("https://www.speedrun.com/api/v1/runs?game=o1y9wo6q&category=wkpoo02r&max=200")$content))$data %>%
select(players) %>%
unnest(players) %>%
select(name) %>%
mutate(name_extract = str_extract(name, "[A-Za-z]*")) %>%
na.omit()
您可以从 name
中删除 [us][jp]
部分。
library(httr)
library(dplyr)
library(jsonlite)
fromJSON(rawToChar(GET("https://www.speedrun.com/api/v1/runs?game=o1y9wo6q&category=wkpoo02r&max=200")$content))$data %>%
select(players) %>%
unnest(players) %>%
select(name) %>%
mutate(name_extract = sub('\[.*\]', '', name)) %>%
na.omit
# name name_extract
# <chr> <chr>
# 1 [us]Deftek Deftek
# 2 [jp]はちみつ (Honey) はちみつ (Honey)
# 3 Hampern Hampern
# 4 [jp]でさんと (Descente) でさんと (Descente)
# 5 [jp]平ボム (Hirabomb) 平ボム (Hirabomb)
# 6 [jp]アキラ (Akira) アキラ (Akira)
# 7 Balls Out Balls Out
# 8 [jp]Teguru Teguru
# 9 [jp]えるも (Erumo) えるも (Erumo)
#10 [jp]Melty Melty
# … with 88 more rows
我不知道如何描述这个问题。我为有史以来最模糊的标题道歉。
这就是数据的样子
[us]Deftek
[jp]<U+306F><U+3061><U+307F><U+3064> (Honey)
Hampern
[jp]<U+3067><U+3055><U+3093><U+3068> (Descente)
[jp]<U+5E73><U+30DC><U+30E0> (Hirabomb)
[jp]<U+30A2><U+30AD><U+30E9> (Akira)
Balls Out
[jp]Teguru
[jp]Melty
因此名称 Hampern 和 Balls Out 提取得很好,但其他名称我无法提取任何内容。
library(httr)
library(tidyverse)
library(jsonlite)
fromJSON(rawToChar(GET("https://www.speedrun.com/api/v1/runs?game=o1y9wo6q&category=wkpoo02r&max=200")$content))$data %>%
select(players) %>%
unnest(players) %>%
select(name) %>%
mutate(name_extract = str_extract(name, "[A-Za-z]*")) %>%
na.omit()
您可以从 name
中删除 [us][jp]
部分。
library(httr)
library(dplyr)
library(jsonlite)
fromJSON(rawToChar(GET("https://www.speedrun.com/api/v1/runs?game=o1y9wo6q&category=wkpoo02r&max=200")$content))$data %>%
select(players) %>%
unnest(players) %>%
select(name) %>%
mutate(name_extract = sub('\[.*\]', '', name)) %>%
na.omit
# name name_extract
# <chr> <chr>
# 1 [us]Deftek Deftek
# 2 [jp]はちみつ (Honey) はちみつ (Honey)
# 3 Hampern Hampern
# 4 [jp]でさんと (Descente) でさんと (Descente)
# 5 [jp]平ボム (Hirabomb) 平ボム (Hirabomb)
# 6 [jp]アキラ (Akira) アキラ (Akira)
# 7 Balls Out Balls Out
# 8 [jp]Teguru Teguru
# 9 [jp]えるも (Erumo) えるも (Erumo)
#10 [jp]Melty Melty
# … with 88 more rows