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
| # Reproducible Example of | |
| # Curvature Blindness Illusion | |
| # Kohske Takahashi, Chukyo University, Japan | |
| # ref: http://journals.sagepub.com/doi/abs/10.1177/2041669517742178 | |
| library(grid) | |
| grid.newpage() | |
| # some params | |
| NY = 48 |
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(ggplot2) | |
| library(gtable) | |
| a = ggplot(data=diamonds, aes(x=price)) + geom_histogram() | |
| b = ggplot(data=iris, aes(x=Sepal.Length, y=Sepal.Width)) + geom_point() | |
| agg = ggplot_gtable(ggplot_build(a)) | |
| bgg = ggplot_gtable(ggplot_build(b)) | |
| g = gtable(width=unit(c(0.3, 0.5), "null"), height = unit(1, "null")) | |
| g = gtable_add_grob(g, agg, 1,1) | |
| g = gtable_add_grob(g, agg, 1,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
| library(grid) | |
| o = function(th) { | |
| yd = -0.5 | |
| grid.circle(0, 1, 0.25) | |
| grid.lines(c(0, 0), c(yd, 1-0.25)) | |
| grid.lines(c(0, 0), c(yd, 0.5), gp = gpar(col="blue", lwd = 3)) | |
| f = 0.25 | |
| grid.lines(c(0, -cos(th)*f), c(0.5, 0.5+sin(th)*f), gp = gpar(lwd=3)) | |
| grid.lines(c(0, +cos(th)*f), c(0.5, 0.5+sin(th)*f), gp = gpar(lwd=3)) |
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=10000; N=1000 | |
| xm = numeric(R) | |
| for (i in 1:R) { | |
| #好きなように | |
| xm[i] = mean(rlnorm(N)) | |
| # xm[i] = mean(rexp(N)) | |
| # xm[i] = mean(runif(N)) | |
| } | |
| hist(xm, breaks = 100, probability = TRUE) |
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
| # zmatにはfactanalに渡したデータをもう一度渡す(因子得点計算用) | |
| promax2 <- function (x, power = 4, kaiser = TRUE, zmat = NULL) | |
| { | |
| if (!is.matrix(x) & !is.data.frame(x)) { | |
| if (!is.null(x$loadings)) | |
| x <- as.matrix(x$loadings) | |
| } | |
| else { | |
| x <- 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
| 教室出版さんのWonderful Rのシリーズで「再現可能性のすゝめ―RStudioによるデータ解析とレポート作成―」という本を書きました。 | |
| 公式サイト: http://www.kyoritsu-pub.co.jp/bookdetail/9784320112438 | |
| Amazon: https://www.amazon.co.jp/gp/product/4320112431 | |
| 書籍紹介より | |
| > データ解析とレポート作成の再現性を高めよう。その先には、ボスの笑顔が待っている。 | |
| > RStudioを使いこなそう。その先には、旨いお鮨が待っている。 | |
| > Rマークダウンをマスターしよう。その先には、明るい未来が待っている。 |
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: "ch01" | |
| output: html_document | |
| --- | |
| ```{r} | |
| library(ggplot2) | |
| a = 1 | |
| b = 2 | |
| a |
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
| Sepal.Length | Sepal.Width | Petal.Length | Petal.Width | Species | ||
|---|---|---|---|---|---|---|
| 1 | 5.1 | 3.5 | 1.4 | 0.2 | setosa | |
| 2 | 4.9 | 3 | 1.4 | 0.2 | setosa | |
| 3 | 4.7 | 3.2 | 1.3 | 0.2 | setosa | |
| 4 | 4.6 | 3.1 | 1.5 | 0.2 | setosa | |
| 5 | 5 | 3.6 | 1.4 | 0.2 | setosa | |
| 6 | 5.4 | 3.9 | 1.7 | 0.4 | setosa | |
| 7 | 4.6 | 3.4 | 1.4 | 0.3 | setosa | |
| 8 | 5 | 3.4 | 1.5 | 0.2 | setosa | |
| 9 | 4.4 | 2.9 | 1.4 | 0.2 | setosa |
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: "heikinn-eno-kaiki" | |
| author: "kohske" | |
| output: html_document | |
| editor_options: | |
| chunk_output_type: console | |
| --- | |
| ```{r} | |
| library(plyr) |
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 is a Shiny web application. You can run the application by clicking | |
| # the 'Run App' button above. | |
| # | |
| # Find out more about building applications with Shiny here: | |
| # | |
| # http://shiny.rstudio.com/ | |
| # | |
| library(shiny) |