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
| #!/usr/bin/env python | |
| # coding: utf-8 | |
| # ライブラリの読み込み | |
| import numpy as np | |
| import pandas as pd | |
| # グラフィックスのフォントはソースコード内で "Noto Sans CJK" に決め打ちされている | |
| import sweetviz as sv | |
| sv.config_parser.read('sweetviz_settings.ini') |
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
| [General] | |
| use_cjk_font = 1 |
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
| # 実行環境の確認 | |
| R.version | |
| # デフォルトの乱数生成器を確認 | |
| RNGkind() | |
| # 巨大な数を生成する | |
| m <- (5/16)*2^32 | |
| 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
| # セルの冒頭で以下を実行し、[ランタイム] - [ランタイムの再起動] を行ってください。 | |
| # その後は、標準のSansフォントとしてIPAexゴシックが使用されますので、family指定などは不要です。 | |
| # 日本語設定スクリプトを実行する | |
| download.file("https://raw.githubusercontent.com/ltl-manabi/shinyapps.io_japanese_font/master/use_ipaex_font.sh", destfile = "use_ipaex_font.sh") | |
| system("bash /content/use_ipaex_font.sh") |
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
| # IPAexフォントをダウンロード、登録する | |
| download.file("https://raw.githubusercontent.com/ltl-manabi/shinyapps.io_japanese_font/master/use_ipaex_font.sh", destfile = "use_ipaex_font.sh") | |
| system("bash ./use_ipaex_font.sh") |
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 | |
| ### shinyapps.ioでグラフの日本語表示をするためのスクリプト | |
| ### Author: Kenta Tanaka (https://mana.bi/) | |
| ### 以下の記事を参考 (ほぼ丸パクり) にしました | |
| ### https://ziomatrix18.blog.fc2.com/blog-entry-853.html | |
| ### | |
| ### 使い方 | |
| ### Shinyアプリ内で以下のように実行してください | |
| ### download.file("https://raw.githubusercontent.com/ltl-manabi/shinyapps.io_japanese_font/master/use_ipaex_font.sh", destfile = "use_ipaex_font.sh") |
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://github.com/rstudio-education/shiny.rstudio.com-tutorial/blob/master/part-1-code/app.R | |
| # 01-kmeans-app | |
| # 列名を日本語に変える | |
| colnames(iris) <- c("がく片長", "がく片幅", "花びら長", "花びら幅", "種") | |
| palette(c("#E41A1C", "#377EB8", "#4DAF4A", "#984EA3", | |
| "#FF7F00", "#FFFF33", "#A65628", "#F781BF", "#999999")) | |
| library(shiny) |
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
| from ambient_api.ambientapi import AmbientAPI | |
| import time | |
| import pandas as pd | |
| api = AmbientAPI(AMBIENT_API_KEY='your-key-here',AMBIENT_APPLICATION_KEY='your-key-here') | |
| devices = api.get_devices() | |
| device = devices[0] | |
| time.sleep(1) # APIの制限を回避するため、1秒待つ |
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
| pip3 install ambient_api |
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(ambientweatheR) | |
| library(tidyverse) | |
| library(weathermetrics) # APIが華氏で温度を返してくるため、変換に使う | |
| mac_address <- list_user_devices() %>% flatten() %>% pluck("macAddress") | |
| df <- seq.Date(as.Date("2021-04-09"), as.Date("2021-04-17"), "day") %>% | |
| map(as.character) %>% | |
| map_df(~ fetch_device_data(mac_address, .x)$content) %>% | |
| mutate(tempc = fahrenheit.to.celsius(tempf), | |
| tempinc = fahrenheit.to.celsius(tempinf), |