2019-01-01ãã1å¹´éã®è¨äºä¸è¦§
Rã²ã¨ãã¢ããã³ãã«ã¬ã³ãã¼26æ¥ç®ã§ãã Rã®officerããã±ã¼ã¸ã¯ä¾¿å©ã§ãã ãã¯ã¼ãã¤ã³ãã§ã¬ãã¼ããç°¡åã«ä½ããã ãããªæãã§ä¼ç¤¾ç¨ã®ãã³ãã¬ã¼ããèªã¿è¾¼ãã§åºåãªãã¦ãã¨ãç°¡åã«ã§ããã library(officer) read_pptx("ä¼ç¤¾ã®ãã³ãã¬ã¼ã.pptâ¦
Rã²ã¨ãã¢ããã³ãã«ã¬ã³ãã¼22æ¥ç®ã§ããçµç¤ã«å·®ãæãã£ã¦ã¾ããã¾ããã ãã¦ãå½å ã®è¨åºè©¦é¨ã¯UMIN-CTRã«ç»é²ããããã«ãªã£ã¦ããï¼ç¹å®è¨åºç 究ã¯jRCTã ã£ãããããï¼ã ããã¦UMIN-CTRã¯ã¹ãããã·ã§ããã¨ãã¦ç»é²æ å ±ãCSVã§å ¬éãã¦ããã httpâ¦
Rã²ã¨ãã¢ããã³ãã«ã¬ã³ãã¼1æ¥ç®ã set.seed()ã¯ä¹±æ°ã®ç¨®ãè¨å®ããé¢æ°ã¨ãããã¨ã¯ããç¥ããã¦ããã ä¹±æ°ã®ç¨®ãè¨å®ãããã¨ã§ãä¹±æ°ã«åç¾æ§ãã¨ããããã«ãªãã ä¾ãã°ä»¥ä¸ã®ï¼è¡ã®ã³ã¼ãã¯ã¾ã¨ãã¦å®è¡ãããã¨ã§æ¯ååãçµæãè¿ãã > set.seed(â¦
read.csv()ã§ä¸æ£ãªå ¥åãããã¾ããã¨è¨ãããã è¦åã ãã ããã¾ãç¡è¦ãããã¨æããããã¼ã¿ãèªã¿è¾¼ãã¦ããªãã > data <- read.csv('data/hoge.csv', as.is = TRUE, fileEncoding = "CP932") è¦åã¡ãã»ã¼ã¸: 1: read.table(file = file, header = hâ¦
ããããã¿ã¤ã ã¹ã¿ã³ãã§ããUNIXæéãJSTï¼æ¥æ¬æ¨æºæï¼ã«å¤æ´ãããã ãã¡ããbaseã®as.POSIXctã使ãã¨ããæãããããç§ã¯originãæå®ããã®ã«ç²ããã¿ãããbaseãå«ãã«ãªã£ããããããªãã ã¨ãããã¨ã§lubridateããã±ã¼ã¸ã®as_datetimeã§ã¿ã¤â¦
Bigqueryã§åå¾ãããã¼ã¿ãæ´å½¢ãããã Bigqueryã§å ¨ã¦å®çµãããªãããããããã¨ããããæéããªãã®ã§ããç¨åº¦BQã§ãã£ã¦ãã¨ã¯Rã§ãããã¨ã«ããã ããããã¹ãããã¦ããã®ã§JSONã§ãããã¦ã³ãã¼ãã§ããªããã¨è¨ããã¦ãã¾ã£ãã ãããJSONã§ãâ¦
ãããªè©±ãããã ç§ã¯å¤§äººæ°ãªãã®ã§Rãªãï¼è¡ãããå®è³ªï¼è¡ã ãã¨ãè¨ã£ã¦ãã¾ãã 以ä¸ã¯opencvããã±ã¼ã¸ã®ãµã³ãã«ã³ã¼ããã®ã¾ã¾ã install.package("opencv") # ã¤ã³ã¹ãã¼ã« library(opencv) unconf <- ocv_read('https://github.com/dichika/ojisaâ¦
ååç©ãã¼ã¿ã®åå¦çãããå¿ è¦ãåºã¦ããã ã¨ãããã¨ã§ããç¨åº¦ç¨èªã¨ããã¼ã«ã®ã¤ã¡ã¼ã¸ãææ¡ãã¦ããããã ç¥ã£ã¦ãéãã§ã¨ããããåæãç¥ããããã¨ãæ´çããã 1.ååç©ãã¼ã¿ã®ãã©ã¼ããã確èªï¼ã¾ãã¯SDFã¨SMILESãè¦ãã¦ããã°è¯ããã 2.â¦
Windowsã®ãã¨ä½ãããCSVãã¡ã¤ã«ãèªã¿è¾¼ãéãCP932ãæå®ãããã¨ããã®ã¯å®ç³ã ããããã§ããã¾ããããªããã¨ãããã ã¨ã©ã¼ã¡ãã»ã¼ã¸ãèªãã¨ãnullãåãè¾¼ã¾ãã¦ãããã¨ããã æå³ãããããªãã ãnullãåãè¾¼ã¾ãã¦ãããã ãã大æ¹ãR embâ¦
ãããªæãã®ãã¼ã¿ããã£ãã¨ããã library(readr) fwf_sample <- readr_example("fwf-sample.txt") cat(read_lines(fwf_sample)) John Smith WA 418-Y11-4111 Mary Hartford CA 319-Z19-4341 Evan Nolan IL 219-532-c301 ããããåºå®é·ãã¼ã¿ã§ããããâ¦
æ°åãã¢ã«ãã¡ãããã«å¤æãããããããã¯ãã®éã§ã¢ã«ãã¡ããããæ°åã«å¤æãããã¨ããã¨ãããã¾ã«ããã¾ãã ä¾ãã°ã11, 12, 13 ãAA, AB, ACã«å¤æãããã¨ããæã§ãã ããããæã¯Rã§ã¯chartr()ãå©ç¨ãã¾ãã chartr("123456789", "ABCDEFGHIâ¦
ãããããã¼ã¿ãããã¨ããã library(dplyr) library(ggplot2) library(gghighlight) ChickWeight_diet <- ChickWeight %>% group_by(Diet, Time) %>% summarise(weight = mean(weight)) > ChickWeight_diet # A tibble: 48 x 3 # Groups: Diet [?] Diet Tâ¦
æå»ãå ¥ãããã¼ã¿ãã¬ã¼ã ãããã¨ããã > smp <- data.frame(now=Sys.time(), then=Sys.time()-60) > smp now then 1 2019-02-09 10:30:15 2019-02-09 10:29:15 ã§ãæå»ã®å·®ãè¨ç®ããã¨ãããã«åä½ãå«ã¾ãã¦ããã > smp$diff <- with(smp, now - thâ¦
åå åãçµåããåã追å ããã°ããã£ã¡ãããã®ã ããggplot2ä¸ã§æå®ããæ¹æ³ããã£ãããªã¨æããªããæãåºããªãã£ã+ã°ã°ãã¥ããã£ãã®ã§ãããåå¿ãinteraction()ã使ãã library(ggplot2) library(dplyr) # ChickWeightãã¼ã¿ã§ååã®ä½éã43以â¦
æè¿æ¬å½ã«å¿ãã£ã½ãã Rã®ããã±ã¼ã¸åãªãã¦ãã¤ã¡ã¼ã¸ã¯æµ®ãã¶ãã®ã®æ£ç¢ºãªå称ãæãåºããªãã ãµãã£ã¨ã°ã°ããã ãã©å½ç¶åºã¦ããªãã ä»æ¹ãªããããè¦ãããããã°ã®è¨äºãç·å½ãããã¦ãã£ã¨è¦ã¤ãããã¨ãã¾ã¾ããã ã¨ãããã¨ã§ããã«ã¡ã¢ãã¦â¦
ã¢ã³ãµã³ãã«å¦ç¿ã¯ä¾¿å©ã ã randomForestãªãLigthGBMãªãXGBoostãªããé©å½ã«ãã¼ã¿ãçªã£è¾¼ãã§ããããªãã®äºæ¸¬ã¢ãã«ãå¾ãããã feature importanceã¨ããå½¢ã§ã©ã®ç¹å¾´éãäºæ¸¬ã«å¹ãã¦ãããããããã ããããã©ãã®ã»ã°ã¡ã³ããæãå¹æçãã¾ã§â¦
æºæã§ãã ä»ã¾ã§ç§ã¯ããåã®æå°å¤ãå«ãè¡ãæ½åºããéãfilter()ãç¨ãã¦ä»¥ä¸ã®ããã«æ¸ãã¦ãã¾ããã library(dplyr) iris %>% filter(Sepal.Length == min(Sepal.Length)) ãããbaseã®æ¸ãæ¹ã§ããã°which.min()ã使ã£ã¦ä»¥ä¸ã®ããã«æ¸ãã¾ãã iriâ¦
ã¿ã¤ãã«ã®ãããªã¤ã¡ã¼ã¸ããæã£ã¦ããããæ¤ç´¢ãã¦ãåºã¦ããããã¯ã½ã¨ã 人åæ¤ç´¢ã§ãã£ã¨è©²å½ããã±ã¼ã¸ãå¤æããã®ã§ãè¨äºã«ãã¦ã¤ã³ããã¯ã¹åãã¦ããã ãã®åã¯ggridgesããã±ã¼ã¸ããã¤ã¦ã¯ggjoyããã±ã¼ã¸ã¨å¼ã°ãã¦ãããã®ãæ¹åãããããâ¦