0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

① Rで丸数字をさっさと扱う ㊿

Last updated at Posted at 2023-02-27

丸数字うざー!!

はい。めんどいですね丸数字
調べても全然情報無いし。

てわけでRだけでサクッと処理するように作ってみました。
ベクトル対応なので雑に手軽に使えると思います〜

pacman::p_load(tidyverse, stringr)
# 丸数字を通常数字に置き換える
marunum2num <- function(input) {
  maru_all <- "①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳㉑㉒㉓㉔㉕㉖㉗㉘㉙㉚㉛㉜㉝㉞㉟㊱㊲㊳㊴㊵㊶㊷㊸㊹㊺㊻㊼㊽㊾㊿"
  maru_v <- str_split_1(maru_all, "")
  onetofifty <- 1:50 %>% as.character
  names(onetofifty) <- maru_v
  str_replace_all(input, onetofifty)
}

R の Named argumentを使った置き換えは色々と応用が効いて便利ですね

0
0
8

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?