Skip to content

Instantly share code, notes, and snippets.

View leoluyi's full-sized avatar
🎯
Focusing

Leo Lu leoluyi

🎯
Focusing
View GitHub Profile
merge_vars <- function(.data, to, from)
{
to = deparse(substitute(to))
from_vars = substitute(from)
from_var_pos <- setNames(as.list(seq_along(.data)), names(.data))
pos <- eval(from_vars, from_var_pos)
y <- .data[[to]]
# 如果不是NA就填回前面變數

If you were to give recommendations to your "little brother/sister" on things that they need to do to become a data scientist, what would those things be?

I think the "Data Science Venn Diagram" (http://drewconway.com/zia/2013/3/26/the-data-science-venn-diagram) is a great place to start. You need three things to be a good data scientist:

  • Statistical knowledge
  • Programming/hacking skills
  • Domain expertise

Statistical knowledge

library("shiny")
x <- runApp(shinyApp(
fluidPage(
"Password:",
tags$input(id = "password", type = "password"),
actionButton("done", "Done")
),
function(input, output) {
observe({
@leoluyi
leoluyi / Front-end-Developer-Interview-Questions-TC.md
Created November 20, 2015 01:45 — forked from hanksudo/Front-end-Developer-Interview-Questions-TC.md
Front-end-Developer-Interview-Questions - 前端工程師面試問題集(繁體中文版)

前端工程師面試問題集

@版本 2.0.0

譯注:此翻譯版,主要給不能流利的讀英文的人看,相關專有名詞還是保留原文。翻譯不好地方請協助pull request.

此repository包含了一些前端開發的面試問題,來審查一個有潛力的面試者。這並不是建議你對同一個面試者問上所有的問 (那會花費好幾小時)。從列表中挑幾個題目,應該就夠幫助你審查面試者是否擁有你需要的技能。

Rebecca MurpheyBaseline For Front-End Developers 也是一篇很棒且值得讀的文章在你開始面試之前。

martingale <- function(max_round = 1000, init_token = 100, bid = 1,
rouletee_prob = c(19/37, 18/37)) {
## max_round: number of bidding
## init_token: initial # of chip
## bid: bidding chip when winning
## rouletee_prob: c(win, lose)
if (sum(rouletee_prob) != 1) stop("sum of 'rouletee_prob' must be 1")
capital = init_token ## current # of chip
@leoluyi
leoluyi / html_table.R
Last active December 29, 2015 12:03
`rvest:::html_table.xml_node` encoding issue
html_table.xml_node <- function(x, header = NA, trim = TRUE,
fill = FALSE, dec = ".") {
stopifnot(html_name(x) == "table")
# Throw error if any rowspan/colspan present
rows <- html_nodes(x, "tr")
n <- length(rows)
cells <- lapply(rows, "html_nodes", xpath = ".//td|.//th")
@leoluyi
leoluyi / solarized-dark.css
Last active January 2, 2016 15:33 — forked from nicolashery/solarized-dark.css
Solarized theme stylesheets for Jekyll and Pygments
/* Solarized Dark
For use with Jekyll and Pygments
http://ethanschoonover.com/solarized
SOLARIZED HEX ROLE
--------- -------- ------------------------------------------
base03 #002b36 background
base01 #586e75 comments / secondary content
@leoluyi
leoluyi / Default (OSX).sublime-keymap
Created May 20, 2016 16:54 — forked from mason-stewart/Default (OSX).sublime-keymap
Better user key bindings for SublimeREPL.
[
// Remapping of *some* SublimeREPL shortcuts
{ "keys": ["ctrl+super+s"], "command": "repl_transfer_current", "args": {"scope": "selection"}},
{ "keys": ["ctrl+shift+,", "s"], "command": "repl_transfer_current", "args": {"scope": "selection", "action":"view_write"}},
{ "keys": ["ctrl+shift+super+f"], "command": "repl_transfer_current", "args": {"scope": "file"}},
{ "keys": ["shift+ctrl+,", "f"], "command": "repl_transfer_current", "args": {"scope": "file", "action":"view_write"}},
{ "keys": ["ctrl+super+l"], "command": "repl_transfer_current", "args": {"scope": "lines"}},
{ "keys": ["shift+ctrl+,", "l"], "command": "repl_transfer_current", "args": {"scope": "lines", "action":"view_write"}},
{ "keys": ["ctrl+super+b"], "command": "repl_transfer_current", "args": {"scope": "block"}},
{ "keys": ["shift+ctrl+,", "b"], "command": "repl_transfer_current", "args": {"scope": "block", "action":"view_write"}}
@leoluyi
leoluyi / zsh.md
Created June 8, 2016 03:09 — forked from tsabat/zsh.md
Getting oh-my-zsh to work in Ubuntu