R
#質å Rã§ããããã°ã©ãï¼ï¼æãç·ã®çµç«¯ã«ã©ãã«ãã¤ãã¦ãã¦ãè²ãç·ã®ã¿ã¤ãã®éããè¦ã«ããã¦ããç·ã¨ã©ãã«ã®å¯¾å¿ãåããã°ã©ãï¼ãä½ãã®ã«ãä¸çªããæ¹æ³ã¯ä½ã§ããããï¼ ãæ示é ããã°å¹¸ãã§ãã #TokyoR #rstatsj URL2016-04-03 10:19:47 via â¦
ãã¤ã¯ï¼ã¨ããã»ã©ã®ãã¨ããªããï¼ãç¸é¢ä¿æ°ï¼Pearson's product-moment correlationï¼ã®ä¿¡é ¼åºéã®ç®åºæ¹æ³ãããç解ãã¦ããªãã£ãã®ã§åå¼·ããããã¾ã¾ã§ã¯Ræ¨æºã® cor.test() ã«é ¼ã£ã¦ã¾ããããã®ãã¼ã¸ãåèã«ããã¦ããã£ããæ¯ç¸é¢ã®æ¤å®ã¨æ¨å®â¦
ããããªãã®ãããï¼ãã¨æã£ã¦ãããã£ãããªãã§ããããªï¼ç¬ï¼ alarm() ããã©ã«ãã®ãã¼ãé³ãé³´ããé¢æ°ã ãã¡ãããé³ã§æãããã¨ããã®ããã®é¢æ°ã®ããããã®ç®çã§ã¯ãªãã ããããã¹ã¯ãªããã®æ«å°¾ã« alarm() ãæ¸ãã¦ããã°ããã®ç¨éã¨ãã¦ä½¿â¦
楽ããï¼ç¡é§ãªï¼Rã¢ã¼ã - ãã«ããï¼è¨èãæ¥æ¬ç¤¾ä¼ãæè²ï¼ âãã®ç¶ç·¨ã ãããã®èµ´ãã¾ã¾ã«æãã¦ã¿ã¾ããã å®å ¨ãªãªã¸ãã«ã§ãã Script x <- runif(10000) y <- runif(10000) col1 <- ifelse( ((y-.5)^2 + (x-.5)^2 >0.3)&((y>.5)&(x<.5)), "#804000"â¦
n <- 2200 X <-runif(n,-1,1); Y <-runif(n,-1,1.5) a <- ifelse( (Y>(X^2)^(1/3)-sqrt(1-X^2))&(Y
ãã¤ããã6ãå½ãããªããã¨ã¼ããã¦ãã人ãããã®ã§ããããã¾ããªããªã£ã¦ãä½ã£ã¦ã¿ã¾ããã å½ããã¨ããã§ããï¼ LOTO6 <- function(x,y,z,v,w){ x <- order(runif(43))[1:6] x[order(x)] } 使ãæ¹ Rãèµ·åã㦠LOTO6() ã®ã«ãã³ã®ä¸ã«ãå¿ è¦äºé ãè¨â¦
Rã®ããã©ã¯å½ç¶æ¨ªæ¸ãã ã¨æã£ã¦ããã¦æ¸ãã¯ç¡çã ã¨ããããã¦ããã ãã©ã以ä¸ã®ãµã¤ããè¦ã¦ãçºæ³ã®è»¢æãããã°ã§ããã¨ãããã¨ãããã£ãã plotã§è»¸ã¿ã¤ãã«ã縦æ¸ãã«ãã - Qiita æ¹è¡ï¼\nï¼ãã¯ãããã¨ããåç´ãªè©±ã ã£ããã ãã©ãæãã¤ããªâ¦
ã¹ã¯ãªããã¯ãã¡ã https://dl.dropboxusercontent.com/u/4689919/BLOG_Pict/predict_avr.R ã¹ã¯ãªãããèµ°ãããçµæ > data(infert) #èªç¶ã»äººå·¥æµç£å¾ã®ä¸å¦çã«é¢ãããã¼ã¿ > > #ã¾ããä¸å¦çã®æç¡ã®äºæ¸¬ã¢ãã«ãä½æ > res <- glm(case ~ age + pariâ¦
ä»åã®Rã«é¢ããè¨äºã¯ãã¸ã¡ã§ããå½¹ã«ç«ã¤äººã«ã¯å¤å°ã¯å½¹ã«ç«ã¤ããããã¾ããã Rã®ããã©ã«ãé¢æ°ã§ãæ¨æºåå帰ä¿æ°ãåºåãã¦ããããã®ã¯ãªãããã ç¬ç«å¤æ°ããã¹ã¦éçå¤æ°ãªããã¨ãã°ãscale() ãªã©ãä»ããã¨ã§ç°¡åã«è¨ç®ã§ãã¾ãã ãããåé¡â¦
誰ããããªé¢æ°ã¤ãããã ãã®ã³ã¼ãã¼ï¼ è·ç¨®ãå°±æ¥ä¸ã®å°ä½ï¼ç¡è·ï¼å¦çãå«ãï¼ãä¼æ¥è¦æ¨¡ãæ§å¥ãæ¢å©æªå©ãåå²æ¡ä»¶ã«ãããæ¯è¼çè¤éãªã³ã¼ãã£ã³ã°ãè¡ãRé¢æ°ã ãã¨ãã°ä»¥ä¸ã®æ§ãªã³ã¼ãã£ã³ã°ã»ã«ã¼ã«ã è·ç¨® å°±æ¥ä¸ã®å°ä½ ä¼æ¥è¦æ¨¡ æ§å¥ é å¶è â¦
æè¿ãå¾åã¹ã³ã¢åæãååå¼·ãã¦ãããé常ã«ãããã£ã±ã«è¨ãã°ãç¡ä½çºå²ãå½ã¦ãä¸å¯è½ãªèª¿æ»è¦³å¯ãã¼ã¿ã«ããã¦ãæ¬ä¼¼çã«ç¡ä½çºå²ãå½ã¦ç¶æ³ãä½ãåºãææ³ãããå°ãåã¿ç ãã¦è¨ãã°ããä¼¼ããã®å士ããæ¢ãã¦ãã®ãã¢ãæ¯è¼ããææ³ã¨è¨ãã°ããâ¦
ãã®åãæãã¦ããå¦çãããã©ã·ã®è£ã«ã³ã£ããã¨æ°åãæ¸ãè¾¼ãã§ããããµã¤ã³ãªé°å²æ°ãé¸ãã ããã¦ãã¦ããã£ããæ°æã¡æªãå æ¯ã ã£ããã ããã©ãèãã¦ã¿ãã¨ãååå ããã¨ã®ãã¨ã ãããã¼ãºå¤§ä½æ¦ã®ï¼è©±ã§ãã£ã¦ãç¸æ§å ãã£ã¦ã©ããã£ã¦ãããâ¦
SPSSãããã¦ãRãã¯ãããã彼女ãã§ãã¾ããï¼ï¼æ±äº¬é½ã»å¤§å¦é¢çï¼ ä»¥ä¸ãã³ã³ã½ã¼ã«ã«ã³ãããã¦ãã ããã ILoveYou <- function(n = 500, col=2, col.bg=8,pch=1){ X <-runif(n,-1,1) Y <-runif(n,-1,1.5) a <- ifelse( (Y>(X^2)^(1/3)-sqrt(1-X^2))&(Y
2015å¹´9æ7æ¥è¿½è¨ ä¸æ¾¤å çã®ãã¤ã¼ãã§ç¥ãã¾ããããä¿¡é ¼åºéãããããããé¢æ°ãå«ãã§ããããã±ã¼ã¸ããã§ã«åå¨ããããã§ãã http://www.inside-r.org/packages/cran/plotrix/docs/plotCI ãã¡ãã使ããã¨ããå§ããã¾ãã plotrixããã±ã¼ã¸ã«ploâ¦
表é¡ã®éãã 次ã®ãã¹ã¤ã¹ãã¼ã¿ãã®ããã«åã±ã¼ã¹èªä½ã«éè¦ãªæå³ãããããã¤ãã±ã¼ã¹æ°ããã£ããå¤ããã¼ã¿ããRã®ããã©é¢æ°ã§ããããããã¨ãå³ã®ããã«æåãéãªã£ã¦ãã¾ããã¨ãããã¾ãã > data(swiss) #ã¹ã¤ã¹ãã¼ã¿ããã¼ã > > # ããã©ã«â¦
誰ããããªé¢æ°ä½¿ããã ãã®ã³ã¼ãã¼ï¼ ã¤ãã£ãã®ã§ã¢ãããã¾ãããã ããã¢ãã«è¨å®ãããªãå人çãªäºæ ãåæ ãã¦ã¾ãã®ã§ãã使ç¨ã®éã¯ã注æä¸ããã ã¨ãããã以ä¸ãã³ãã¼ï¼ãã¼ã¹ã ### 注æï¼ï¼ï¼ ### 以ä¸ã¯ã4次ã®ã¯ãã¹è¡¨ã§2çªç®ã3çªç®ã4â¦
ãã«ããæ¢ãåãã¾ãããããªãã®ã§ä½ãã¾ããã ãèªç±ã«ã使ãä¸ããã 以ä¸ãã³ãããã¦ãã ãã tadasi <- function(text,p){ x1 <- unlist(strsplit(text,NULL)) res <- NULL for( i in 1:length(x1)){ if(x1[i]!="ã" & x1[i]!="." & x1[i]!="ï¼"){ #â¦
UverWorldã«ä¼¼ã¦ããã¨è¨ãããåæ°ãããFukuta's U ãè¿ãRã¹ã¯ãªãããä½ãã¾ããã ãèªç±ã«ã使ãä¸ããã ã¹ã¯ãªãã 以ä¸ãã³ãã¼ï¼ãã¼ã¹ããã¦ãã ãã FukutaU <- function(c){ 0.5 / (exp(1/c) - 0.5) } Fukuta's Uã®æ¦è¦ UverWorld ã®ãã¼ã«ã«ã®â¦
ã ãããããªé¢æ°ä½¿ããã ãã®ã³ã¼ãã¼ recode() é¢æ°ãå©ç¨ãã¦ããã®ã§ã > library(car)ã§ãcar ããã±ã¼ã¸ããèªã¿è¾¼ãã§ããã¦ãã ããã ãã¶ããæ·±å»ãªééãã¯ãã¦ããªãã¨æãã¾ããããã¨ãã°ããããªè·æ¥åãããªãï¼ããªã©ããªã«ããæ°ã¥ãã®ç¹â¦
ã¹ã¯ãªãã 以ä¸ãã³ãã¼ï¼ãã¼ã¹ããã¦ãã ãã azc <- function(m){ sum(max(m/sum(m)) - (m/sum(m)) )/( length(m)-1) } å®ç¾© ãããã³ãã«ããã¦ãç¹å®ã®äººç©ï¼ä¸è¬çã«ãã¼ã«ã«ï¼ã«äººæ°ã»ç¥å度ã»è²¢ç®åº¦ãä¸æ¥µéä¸ãã¦ãã度åãããå®å ¨å°å¸¯ãã«ã¡ãªã¿â¦
Rã§æ¥æ¬èªã®æåãå«ãã å³ãepsã§åºåãããã¨ããã¨ããã¾ãåæ ãããªãã¯ãã§ãã 解決çã¨ãã¦ä»ã¾ã§åã¯ã次ã®ãããªã®ãã¤ãã£ã¦ãã¾ããã æ¥æ¬èªãããã¦è±èªã§è¡¨ç¾ãã ãã¼ãåã§è¡¨ç¾ãã .emf ãªã©ã§åºåãã¦ããã³ã³ãã¼ã¿ãªã©ã§ .eps ã«å¤æãâ¦
ãã®è¨äºï¼éèªãè±èªæè²ãï¼æ¦å¾ï¼ã®éçå¾åããã£ã¨è¦ã - ãã«ããï¼è¨èãæ¥æ¬ç¤¾ä¼ãæè²ï¼ï¼ã®ç¶ãã§ããåè¿°ã®ãè±èªæè² Fiftyãéé²ã®è¨äºã¿ã¤ãã«ã®ãã¼ã¿ã¯ã¨ã¯ã»ã«å½¢å¼ã§æä¾ããã¦ããã¯ããªã®ã§ã表è¨ç®ã½ãããªã©ãã¤ããã°ãããç¨èªã®ãã¬â¦
hoshi(x) hoshi <- function(x,ns){ X <- NULL for(i in 1:length(x)){ if(x[i] < .001){X[i] <- c("***") }else{ if(x[i] >= .001 & x[i] < .01){X[i] <- c("**") }else{ if(x[i] >= .01 & x[i] < .05){X[i] <- c("*") }else{ if(x[i] >= .05 & x[i] < .1 )â¦
3次ã®ã¯ãã¹è¡¨ã®ãã°ãªãã¢åæãããã£ã¨ã¹ã¿ã¤ãªãã·ã¥ï¼ç¬ï¼ã«ã§ããããããªãã¨æãã¤ã¤è²ã 試è¡é¯èª¤ããããã¾ãããããã¨ããããç ãã®ã§ä½ãããã®é¨åãã¡ã¢ãã¦ããã # ä¸ã¤ã®å¤æ° A, B, & C ããã¨ã«ã¯ãã¹è¡¨ ### x <- table(A , B , C) ### â¦
RMeCabã®ã¤ã³ã¹ãã¼ã«ãå¿ è¦ â library(RMeCab) è¿½è¨ r-de-rããã«å©è¨ããã ãã¾ããããããã¨ããããã¾ãããã£ã¨æ´ç·´ãããã³ã¼ããææ¡ãããã®ã§è¬¹ãã§ã³ããï¼ãã¿ã¾ããï¼ãã¾ãã hyahhaaa2 <- function(x, y) { b <- unlist(RMeCabC(x)) b[names(â¦
ãããããã å½¢æ ç´ è§£æã¨ã³ã¸ã³åå¸èªï¼MeCabãããã¶ï¼ ããã³ããã®Rç¨ã®ããã±ã¼ã¸ã¨ãã¦ã RMeCab ã®ã¤ã³ã¹ãã¼ã«ãå¿ è¦ã§ãã詳細ã¯ä¾ãã°ãã¡ãããåèã«ãã¦ãã ããâ"RMeCabä½æè ã»ç³ç°åºåºå çã«ãã解説ï¼PDFï¼" ï¼ç¬ï¼æ·»ä»é¢æ°ï¼RKakkoWarai(â¦
http://www.okada.jp.org/RWiki/?Tips%2F%A5%A8%A5%E9%A1%BC%A5%D0%A1%BC%A1%A6%BF%AE%CD%EA%B6%E8%B4%D6 plot() 㨠arrows() ãåããã¦ããã¨ç°¡åã«ã§ããã ãªã®ã§ãå°ç¨ã®ããã±ã¼ã¸ãæ°ãã«ã¤ã³ã¹ãã¼ã«ããå¿ è¦ã¯ç¹ã«ãªãããã ã ãã¤ã³ãã¯ã arrowsâ¦
ãªã¹ãå½¢å¼ãtransactionså½¢å¼ã«å¤æããéãéè¤ãããã¨ã¨ã©ã¼ãåãåºããããã ï¼ãã¡ãã®ãã¼ã¸ãåèã«ããã¦ããã ãã¾ãããå¤è¬ãâhttp://d.hatena.ne.jp/hiru926/20100103/1262508600ï¼ ã¨ããããã§ããã«ããªã©ãæ¢ãåããã ãã©ãç§ã®ãæ¤ç´¢â¦
å¿æ´ã³ã¡ã³ããé ããã®ã§å æ°ãã§ã¦ãã¾ããï¼ç¬ï¼ããããã¨ããããã¾ãã å®è·µç·¨ï¼å®éã®åæäºä¾ï¼ã¯ã寺沢ãæ¥ä¼ã¿ä¸ã«å人çã«éå¬ããRåå¼·ä¼ã¨é£åããï¼ã¨ããããåå¼·ä¼ç¨ã®ã¬ã¸ã¡çããã¡ãã«ä½¿ãåãï¼äºå®ãªã®ã§ããã°ããå¾ ã¡ä¸ããã ãã¦ãâ¦
å¤å½èªæè²ç 究ã«ãçµ±è¨ã½ããRãã使ããï¼ï¼ãã®ï¼ï¼ã®ç¶ç·¨ã§ãã以ä¸ã®ï¼ç¬åçï¼ããã¼ãã£ã¼ãã«åºã¥ãã¦ãRã®æ義ãã説æãã¾ãã (1)èªåã§çµ±è¨è§£æãããå¿ è¦ããããï¼ å¤å½èªæè²ç 究ã«æºããã®ã§ããã°ãè«æã®å¤ããè¨éçãªææ³ã§è¡ããã¦ããâ¦