Matrix

  행렬의 기본 Linear  Algebra를 통해 해를 구할때 관점                             문제를 보는 관점 Row 방향:                                  직선/평면..의 방정식으로 (dot product, 내적) Column방향:      벡터들의 Read more…

identical vs all.equal

https://stackoverflow.com/questions/9508518/why-are-these-numbers-not-equal 숫자 비교시, 아주아주 정확할 필요가 없다면 identical() 보다는 all.equal()을 사용하는 편이 정신건강에 좋다. > i <- 0.1 > i <- i + 0.05 > identical(i, 0.15) [1] FALSE > identical(round(i,1), 0.15) [1] FALSE > identical(round(i,2), 0.15) [1] TRUE > all.equal(i, 0.15) [1] TRUE > i <- 0.1 > i Read more…

webAPI plumber

http://blog.expresspixel.com/creating-a-web-api-for-r/   https://www.rplumber.io/ https://github.com/trestletech/plumber https://www.rplumber.io/docs There’s 3 options for you to use to build a web based API. 1. Shiny, 2. Deployrand 3. Plumber. prediction.R #* @get /prediction function(){ return(“Hello World”) } main.R #!/usr/bin/env Rscript library(plumber) r <- plumb(“prediction.R”) r$run(host=”0.0.0.0″, port=8000)   ~/sixx/webAPI$ Rscript main.R Starting server to listen on port 8000   Read more…

data.table

  > A <- as.data.frame(a) > A a 1 NA 2 TRUE 3 FALSE 4 NA > AA <- as.data.table(A) > AA[,(nn):=NULL] Error in eval(lhs, parent.frame(), parent.frame()) : object ‘nn’ not found > AA[,(nn):=NA] Error in eval(lhs, parent.frame(), parent.frame()) : object ‘nn’ not found > AA[,.(nn):=NA] Error in eval(lhs, parent.frame(), Read more…

KODI

  Kodi (formerly XBMC) media player and entertainment hub https://kodi.tv/   설치하면 어떤 Contents도 없기때문에,  설정이 필요하다. 기본설정 처음 화면을 Full mode 때문에 당황스럽기 때문에, widnow mode (/)로~ 한글문제:   설정>skin settings>  font >> Arial based   PVR client list 내부에서만 본다면 pvr client 플러그인만 설치해도 되지만, 외부에서도 보고 녹화도 한다면 Read more…

CSS with regex for id

https://stackoverflow.com/questions/42497352/css-with-regex-for-id <div id=”sections”> <div id=”s10″>one</div> <div id=”s2″>two</div> <div id=”s30″>three</div> <div id=”t1″>four</div> </div>  id$=’0′  는 id가 0으로 끝나는 거  id^=’s’  는 id 가 s로 시작하는 거  #sections div[id^=’s.*0′] { color: red; } #sections div[id$=’0′][id^=’s’] { color: red; }   https://developer.mozilla.org/pl/docs/Web/CSS/Attribute_selectors /* <a> elements with a title attribute */ a[title] { color: Read more…

popup size

g_fun.R bsModalNoFoot – size bsModalNoFoot <- function (id, title, trigger, …, easyClose = FALSE, size) { if (!missing(size)) { if (size == “large”) { size = “modal-lg” } else if (size == “small”) { size = “modal-sm” } size <- paste(“modal-dialog”, size) } else { size <- “modal-dialog” } bsTag Read more…

shinyjs run javascript

https://www.jqueryscript.net/demo/Animated-Circles-Loading-Spinner-jQuery-g-spinner/ src\css\gspinner.css src\js\g-spinner.js How to use it: 1. Load the minified versions of the g-spinner plugins JS & CSS in your webpage which has jQuery library loaded. <link rel=”stylesheet” href=”gspinner.min.css”> <script src=”jquery.min.js”></script> <script src=”g-spinner.min.js”></script> 2. Create a DIV element where we want to insert the loading indicator into: <div id=”loader”> </div> 3. We need a Read more…

rspm (rstudio package manager)

https://www.rstudio.com/products/package-manager/ repository management server to organize and centralize R packages across your team Get offline access to CRAN, automate CRAN syncs, share local packages, restrict package access, find packages across repositories http://docs.rstudio.com/rspm/admin/quickstarts.html http://docs.rstudio.com/rspm/admin/ We currently only provide a pre-built binary for the 64-bit architecture. Execute the following commands in a Read more…

Error: stat_smooth requires the following missing aesthetics

  geom_smooth(stat_smooth)에 상속된 aes()가 잘못됐을 경우 발생  http://stulp.gmw.rug.nl/ggplotworkshop/twocontinuousvariables.html  ::  12.1.1.1 inherite.aes ### 동력전달타입(drv)별 배기량(displ)이 도심 주행연비(cty)에 미치는 영향 p <- mpg %>% ggplot(aes(displ, cty, color=drv)) p + geom_point() + geom_smooth(method=”lm”, se=F) ### same above —- p + geom_point(inherit.aes=T) + geom_smooth(method=”lm”, se=F, inherit.aes=T) p + geom_point( data=mpg, aes(x=displ, y=cty, colour=drv)) + geom_smooth(data=mpg, Read more…

facet_wrap ylim

https://chrischizinski.github.io/rstats/using_geom_blank/ https://stackoverflow.com/questions/18046051/setting-individual-axis-limits-with-facet-wrap-and-scales-free-in-ggplot2 set.seed(666) foo.dat<-rbind(data.frame(group=”A”, x = runif(50), y=rnorm(50,mean=5)), data.frame(group=”B”, x = runif(50), y=rnorm(50,mean=5,sd=3)+20), data.frame(group=”C”, x = runif(50), y=rnorm(50,mean=5,sd=5)+30)) ## Plot it in ggplot ggplot() + geom_point(data=foo.dat,aes(x=x,y=y,colour=group),size=4) + facet_wrap(~group,scales=”free_y”) + ## using scales=”free_y” allows the y-axis to vary while keeping x-axis constant among plots theme_bw() ggplot() + geom_point(data = foo.dat, aes(x Read more…

UIOutput level plot test

  library(shinyWidgets) #draw_data <- readRDS(“/home/sixx/d2cm/1.RCodes/4.Etc/9.sixx/draw_data.rds”) init_env0 <- function(){ env <- new.env() env$dd <- NULL return(env) } env6 <- init_env0() server <- function(input,output, session){ uFunc_draw_plot<- function(dd, selected_col, val_limit){ p <- dd %>% ggplot(aes_string(x=”sec”, y=”val”, group=”subid”, color=selected_col)) + coord_cartesian(ylim=val_limit) + geom_point() + geom_line() output$O_plt_main <- renderPlot({ return(p) }) } observeEvent(input$I_btn_load_make_dd, { if Read more…

shinyWidget :: radioGroupButtons

  library(shinyWidgets) server <- function(input, output, session) { output$val <- renderText({ input$rdoG_letter }) } ui <- fluidPage( fluidRow( column(width=3, radioGroupButtons(“rdoG_letter”, label=”Choose one:”, choices=list(“A”=1,”B”=2,”C”=3), selected=3, width=”100%” #individual = T, direction = “vertical”, status = “danger” )), column(width=9, verbatimTextOutput(“val”)) ) ) shinyApp(ui, server) radioGroupButtons(inputId, label = NULL, choices = NULL, selected = Read more…