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
## This gist is obsoleted. Refer https://github.com/mokjpn/Define2Validate/ for the new version. | |
library(R4DSXML) | |
library(testthat) | |
library(validate) | |
define2validate <- function(domain, file="exampleRules.yaml", definexml="Odm_Define.xml") { | |
varmd <- subset(getVarMD(definexml), IGD_Name == domain) | |
cat(file=file, append=FALSE, "") | |
out <- function(...) cat(file=file, append=TRUE, paste(...,"\n",sep="")) |
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
## いわゆる目標症例数とリクルートの進捗状況のグラフ | |
# ダミーの日付データを作る | |
# リクルート日付は2014-01-01からの2年間からランダムに100日 | |
dates <- as.Date("2014-01-01") + 365*2*runif(100) | |
# それぞれの日に10人までのランダムな人数がリクルートされたとするダミーデータ、100日分 | |
number <- floor(10*runif(100)) | |
# 1行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
## いわゆる目標症例数とリクルートの進捗状況のグラフ | |
# ダミーの日付データを作る | |
# リクルート日付は2014-01-01からの2年間からランダムに100日 | |
dates <- as.Date("2014-01-01") + 365*2*runif(100) | |
# それぞれの日に10人までのランダムな人数がリクルートされたとするダミーデータ、100日分 | |
number <- floor(10*runif(100)) | |
# 1行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
## いわゆる目標症例数とリクルートの進捗状況のグラフ | |
# ダミーの日付データを作る | |
# リクルート日付は2014-01-01からの2年間からランダムに100日 | |
dates <- as.Date("2014-01-01") + 365*2*runif(100) | |
# それぞれの日に10人までのランダムな人数がリクルートされたとするダミーデータ、100日分 | |
number <- floor(10*runif(100)) | |
# 1行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
## 同じ整数の繰り返しである数列に含まれる数を1つずつ使い、目的の数を作るための式を総当たりで求める | |
## Usage: npuzzle(2,4,24) => (2,2,2,2)を1つずつ使って24を作るにはどうするか. | |
npuzzle <- function(num, nrep, target, twofuncs = list( | |
"*"=function(x,y){x*y}, | |
"/"=function(x,y){x/y}, | |
"+"=function(x,y){x+y}, | |
"-"=function(x,y){x-y}, | |
"^"=function(x,y){x^y}), onefuncs = list( | |
" "=function(x){x}, | |
"factorial"=function(x){factorial(x)}, |
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 m5stack import lcd | |
import socket | |
import os | |
def split_list(l, s): | |
count = 0 | |
ni = [] | |
for i in range(0, len(l)-len(s)): | |
if l[i] == s[count]: | |
count=count+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
from m5stack import lcd | |
from mqtt import MQTTClient | |
import time | |
import ujson | |
import ussl | |
import socket | |
import machine | |
MACHINE=hex(int.from_bytes(machine.unique_id(), 'big'))[2:] |
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
--- | |
title: "Rでe-Statの統計表から都道府県別SMRを描く" | |
output: html_document | |
--- | |
このテキストでは、政府統計e-StatのAPIを使って、Rに直接統計表を読み込み、それを処理して特定の疾患(ICD-10に基づいた死因簡単分類で指定)の都道府県別の標準化死亡比(Standard Mortality Ratio, SMR)を算出し、その値によって都道府県を塗り分けた地図をかいてみます。すべてRの中だけで完結し、またプログラムの長さも短くて済んでいることに注目してください。 | |
```{r, echo=FALSE, results='hide'} | |
appId <- "0000000000000000000000000000000000000000" |
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
const m5 = require('m5stickcjs'); | |
var obniz = new m5("XXXXXXXX"); | |
obniz.onconnect = async function () { | |
// lcd = obniz.wired('ST7735S', { mosi: 15, sclk: 13, dc: 23, res:18, cs:5}); | |
lcd = obniz.m5display; | |
await lcd.onWait(); | |
console.log(lcd.width); //128 | |
console.log(lcd.height); //160 | |
lcd.setRotation(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
# Control SwitchBot with M5Atom+PIR sensor unit | |
# Many thanks to https://tech.fusic.co.jp/posts/2020-04-01-switchbot-with-m5stack/ | |
#include <M5Atom.h> | |
#include "BLEDevice.h" | |
#define SWITCHBOT_MAC "XX:XX:XX:XX:XX:XX" | |
static BLEUUID serviceUUID("CBA20D00-224D-11E6-9FB8-0002A5D5C51B"); | |
static BLEUUID characteristicUUID("CBA20002-224D-11E6-9FB8-0002A5D5C51B"); | |