- データセットの作成(matrix,dist)
- デンドログラム(樹形図)のプロット方法
- グラフによる可視化
- 標本調査
- ランダムサンプリングで標本数は、どのくらいあればいいのでしょうか?
- 標本はいくつ集めたらよいか
- http://www.ceser.hyogo-u.ac.jp/naritas/spss/sample_size/sample_size.htm
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
# kaggle titanic | |
# https://www.kaggle.com/c/titanic-gettingStarted/data | |
t <- read.csv("../../Downloads/train.csv") | |
names(t)<-tolower(names(t)) | |
idx<- sample(nrow(t),(nrow(t)*0.7)) | |
t.tr <- t[ idx,] | |
t.te <- t[-idx,] |
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
PREF_CODE | NAME | REGION | |
---|---|---|---|
01 | 北海道 | 北海道 | |
02 | 青森県 | 東北 | |
03 | 岩手県 | 東北 | |
04 | 宮城県 | 東北 | |
05 | 秋田県 | 東北 | |
06 | 山形県 | 東北 | |
07 | 福島県 | 東北 | |
08 | 茨城県 | 関東 | |
09 | 栃木県 | 関東 |
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
get_latlng_from_address<-function(zipcode){ | |
require("rjson") | |
url.template<-"http://maps.googleapis.com/maps/api/geocode/json?language=ja&address" | |
url <- paste(url.template,zipcode,sep="=") | |
map_data <- fromJSON(paste(readLines(url), collapse="")) | |
if(map_data$status=="OK"){ | |
address_info <- map_data$results[[1]]$address_components | |
location <- map_data$results[[1]]$geometry$location | |
res <- data.frame( | |
zipcode= zipcode, |
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
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/vue/0.12.16/vue.min.js"></script> | |
</head> | |
<body> | |
<h1>タイピングてすと:function</h1> | |
function + enter で計測 |
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('RUnit') | |
source('./mysum.r') | |
# refs | |
# - http://cran.r-project.org/web/packages/RUnit/RUnit.pdf | |
# - http://www.okada.jp.org/RWiki/?RUnit%20%A4%F2%BB%C8%A4%A6 | |
test.mysum <- function(){ | |
checkEqualsNumeric(mysum(1:10),55) | |
} |
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
bind.params<-function(txt.template,...){ | |
require("dplyr") | |
loop.cnt <- | |
txt.template %>% | |
strsplit(.,"") %>% | |
unlist %in% | |
c('?') %>% | |
which %>% | |
length | |
res <- txt.template |
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
import datetime | |
import calendar | |
def lastday_of_month(date): | |
y = date.year | |
m = date.month | |
last_d = calendar.monthrange(y, m)[1] | |
return date.replace(day=last_d) |