This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(lubridate) | |
library(scales) | |
library(ggthemes) | |
options(dplyr.width = Inf, scipen = 1, digits = 4) | |
# 任意のフォントに変更してください | |
theme_set(theme_fivethirtyeight(base_family = "IPAexGothic", base_size = 12)) | |
theme_update(plot.title = element_text(size = 14), axis.title = element_text()) | |
library(rvest) | |
library(tibbletime) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
アップロードしたノートブックについて、以下のようにテキストと画像を生成し、空白のセル内に追記してください。 | |
* レベル3の見出し (###) について、内容を読み取り、見出しのトピックについて説明する日本語の文章を箇条書きで3個から5個生成してください。 | |
* 生成した箇条書きは、Markdown形式で見出しの直下の空白セル内に追記してください。 | |
* 箇条書きの文体は「である調」にしてください。 | |
* 架空の情報を使用しないでください。 | |
* 見出しの項目を変更せず、ノートブックから読み込んだものを使ってください。 | |
* 書籍やインターネット上の資料に言及する際は、出典となる書名、URLを示してください。 | |
* 作成した箇条書きを視覚的に的確に表現する図またはイラストを生成してください。表現は、大学の授業で使用する比較的フォーマルなものにしてください。 | |
* 図またはイラストにおいて、日本語のラベルなどが文字化けしないよう、図またはイラストを作成する際には、Matplotlibで日本語フォントを使用するように設定してください。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fivethirty eight color palette | |
# タナカケンタ (鶴見教育工学研究所) | |
# ggthemesパッケージで提供されているパレットが3色しかないため、Pythonのmatplotlibのstyle sheetから借用して6色に | |
# パレットの作り方は以下を参考にした | |
# https://meghan.rbind.io/blog/2022-10-11-creating-custom-color-palettes-with-ggplot2/ | |
fivethirtyeight_color <- function(...) { | |
fivethirtyeight_colors <- c( | |
`blue` = "#008fd5", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ChannelAttribution) | |
library(markovchain) | |
library(igraph) | |
library(ggplot2) | |
data(PathData) | |
H<-heuristic_models(Data,"path","total_conversions",var_value="total_conversion_value") | |
H | |
M<-markov_model(Data,"path","total_conversions",var_value="total_conversion_value",out_more=T) | |
M |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(jsonlite) | |
library(leaflet) | |
library(htmlwidgets) | |
library(htmltools) | |
# 横浜市交通局バスロケーション情報の取得 | |
# APIキーはご自身で取得し、以下の "consumerKey=" 以降に付与してください。 | |
url <- "https://api.odpt.org/api/v4/odpt:Bus?odpt:operator=odpt.Operator:YokohamaMunicipal&acl:consumerKey=XXXXXXXXXXXXXXXXXX" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 自分のフォロワーのプロフィール情報を取得してワードクラウドを作る | |
library(twitteR) | |
library(RMeCab) | |
#library(wordcloud) | |
library(wordcloud2) | |
library(Cairo) | |
library(extrafont) | |
loadfonts(quiet = TRUE) | |
setup_twitter_oauth(consumer_key = "fAlW58d11EJ0UnSiWxUQydtSN", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(stringi) | |
library(httr) | |
library(jsonlite) | |
names <- c("白石麻衣", "生田絵梨花", "齋藤飛鳥") | |
for (i in 1:length(names)){ | |
chars <- unlist(strsplit(names[i], split = "")) | |
for (j in 1:length(chars)){ | |
chars_ucs <- stri_escape_unicode(chars[j]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 「横浜市立学校 空気の見える化プロジェクト」(https://minnaair.com/blog/yokohama/) のデータを取得するRスクリプト | |
# タナカケンタ (鶴見教育工学研究所) | |
# https://mana.bi/ | |
# | |
# プロジェクトのWebページにアクセスし、データをスクレイピングし、整形するスクリプトです。 | |
# (どういうわけか) Webページの中に全期間の生データが直接書いてある🤪ので、それを取得しています。 | |
# 今後データが増えていったら、ページの読み込み速度がどんどん遅くなりそうですが... | |
# 現在のところ、2023/01/20頃から本運用が開始され、それ以降のデータがすべて取得できるようですので、 | |
# このスクリプトでは前回の結果からの差分を取る、といったことはしていません。 | |
# スクリプトの利用、改変はご自由にどうぞ。ただし、スクレイピングの間隔は空けて、サービス提供者の負荷に |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 参考: 【GoogleColaboratory】歌ネット(Uta-Net)から歌詞をスクレイピングする https://zenn.dev/robes/articles/00e86185677fb5 | |
library(tidyverse) | |
library(httr) | |
library(rvest) | |
base_url <- "https://www.uta-net.com" | |
#urls <- "https://www.uta-net.com/artist/6636/" | |
# とりあえずAKB48と乃木坂46と櫻坂46を選択 (オッサンには区別がつかないですが...) | |
urls <- c("https://www.uta-net.com/artist/6636/0/1/", "https://www.uta-net.com/artist/6636/0/2/", "https://www.uta-net.com/artist/12550/", "https://www.uta-net.com/artist/29512/") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# RStudioでファイルを開き、"Run Script" ボタンで実行してください | |
# ご覧の通り、ただ pip コマンドを実行しているだけですので、 | |
# ターミナルを開いてコマンドが打てる方が対象 (学生、研修受講者) であれば | |
# わざわざこのスクリプトを実行する必要はありません | |
pip install sudachipy sudachidict_core sudachidict_full |
NewerOlder