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
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
library(dplyr)
con <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
DBI::dbWriteTable(con, "mtcars", mtcars)
mtcars2 <- tbl(con, "mtcars")
mtcars2
mtcars2 %>%
select(cyl) %>%
--- introduction.Rmd 2017-04-13 21:34:20.746708500 +0900
+++ dplyr.Rmd 2017-04-13 21:32:54.691292800 +0900
@@ -1,6 +1,5 @@
---
title: "Introduction to dplyr"
-date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Introduction to dplyr}
@@ -13,6 +12,7 @@