Skip to content

Instantly share code, notes, and snippets.

View yutannihilation's full-sized avatar
🍣
Nobody loves you

Hiroaki Yutani yutannihilation

🍣
Nobody loves you
View GitHub Profile
;; add load-paths
(add-to-list 'load-path "~/.emacs.d/elisp")
(require 'package)
;; MELPA
(add-to-list
'package-archives
'("melpa" . "http://melpa.org/packages/") t)
f <- function(return_true = TRUE) {
function(return_true = return_true) {
if (return_true) return(TRUE)
FALSE
}
}
f()
#> function(return_true = return_true) {
#> if (return_true) return(TRUE)
#> FALSE
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(sf)
@yutannihilation
yutannihilation / ggjoy.R
Last active July 22, 2017 14:34
第63回 Tokyo.RのLTのスライド用のコード
library(ggjoy)
library(dplyr)
library(purrr)
# data ------------------------------------------------------------
set.seed(10)
l <- rerun(26, rnorm(1000, mean = runif(1), sd = sqrt(runif(1))))
names(l) <- LETTERS
library(tidyverse)
# parameters ---------
steps <- 10000L
coil_turns <- 20L
rotation <- pi/2
coil_waviness <- 100
wave_height <- 1.5
# インストール
devtools::install_github("tidyverse/googledrive")
# 認証
drive_auth()
tmp_doc <- tempfile(fileext = ".doc")
# word_documentなRmdをrender()
rmarkdown::render("~/Rmd/test.Rmd", output_file = tmp_doc)
library(dplyr, warn.conflicts = FALSE)
library(ggplot2)

day <- lubridate::as_datetime(Sys.Date())
d <- tibble::tibble(
  x = day + lubridate::minutes(0:147 * 30),
  y = 0,
  day = lubridate::day(x)
)
library(httr)
library(tidyverse)
#> Loading tidyverse: ggplot2
#> Loading tidyverse: tibble
#> Loading tidyverse: tidyr
#> Loading tidyverse: readr
#> Loading tidyverse: purrr
#> Loading tidyverse: dplyr
#> Conflicts with tidy packages ----------------------------------------------
#> filter(): dplyr, stats
# Rのコピー修正の例
## 元のデータを上書きしない場合
### `mutate()`
``` r
library(pryr)
library(dplyr, warn.conflicts = FALSE)
d <- tibble(x = 1:1000000, y = 1:1000000)
@yutannihilation
yutannihilation / .gitignore
Last active May 7, 2017 11:25
Error with blogdown::html_page() on CJK Windows
.Rproj.user
.Rhistory
.RData
.Ruserdata