group_by() %>% nest()のショートカット。↑のExamplesのコードがわかりやすいのでそのまま実行してみる。
nest_join()はfull_join()以外のjoinを一般化するものらしい。おもしろい。
nest_join()is the most fundamental join since you can recreate the other joins from it. Aninner_join()is anest_join()plus an [tidyr::unnest()], andleft_join()is anest_join()plus anunnest(drop = FALSE). Asemi_join()is anest_join()plus afilter()where you check that every element of data has at least one row, and ananti_join()is anest_join()plus afilter()where you check every element has zero rows.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(leaflet) | |
| # 先にbasemapをつくっておく | |
| basemap <- leaflet() %>% | |
| addTiles("http://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png", | |
| attribution = "<a href='http://maps.gsi.go.jp/development/ichiran.html' target='_blank'>地理院タイル</a>") | |
| library(mapview) | |
| # つくったbasemapをmap引数に指定する |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| output: github_document | |
| --- | |
| ```{r setup, include=FALSE} | |
| knitr::opts_chunk$set(echo = TRUE) | |
| orig_hook <- knitr::knit_hooks$get("output") | |
| knitr::knit_hooks$set( |
foo <- function(x = list()) structure(x, class = "foo")
`+.foo` <- function(e1, e2) message("foo!")
bar <- function(x = list()) structure(x, class = "bar")
`+.bar` <- function(e1, e2) message("bar?")
# unaddable, no methods
list() + list()
#> Error in list() + list(): non-numeric argument to binary operator# https://github.com/GuangchuangYu/shadowtext/blob/master/vignettes/shadowtext.Rmd
library(ggplot2)
library(shadowtext)
random_text <- function(n=1, length=10) {
d <- data.frame(n=1:n, length=length)
sapply(1:nrow(d), function(i) {
paste(sample(c(0:9, letters, LETTERS),
d$length[i], replace=TRUE),library(ggplot2)
# To reproduce this error shadowtext is installed from source, not binary.
library(shadowtext)
set.seed(1)
d <- data.frame(x = rnorm(3), y=rnorm(3), label = c('hello', 'world', '!!!'))
ggplot(d, aes(x,y)) +
geom_shadowtext(aes(label=label, color=label), bgcolor='firebrick')
#> Error in col[, rep(1, length(alpha)), drop = FALSE]: subscript out of boundslibrary(tidyverse)
library(gghighlight)
d <- mtcars %>%
#filter(drat >= 3) %>%
select(mpg,disp,hp,drat) %>%
gather(variable, value, -disp, -hp, -drat)
d
#> disp hp drat variable valuelibrary(tidyverse)
library(gghighlight)
mtcars %>%
select(mpg,cyl,disp,hp,drat) %>%
gather(variable, value, -disp, -hp, -drat, -cyl) %>%
mutate(cyl = factor(cyl)) %>%
ggplot(aes(disp,value,color=factor(drat))) +
facet_wrap( ~ cyl, labeller = label_both, drop = FALSE) +
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 参考: | |
| # - https://github.com/rwinlib/arrow | |
| # - https://github.com/apache/arrow/blob/master/cpp/apidoc/Windows.md#building-using-visual-studio-msvc-solution-files | |
| # Update packages | |
| pacman -Syu | |
| pacman -Su | |
| # Use Rtools | |
| export CC=/c/Rtools/mingw_64/bin/gcc |