Skip to content

Instantly share code, notes, and snippets.

View kenjisato's full-sized avatar

Kenji Sato kenjisato

View GitHub Profile
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
1.000000000000000000e+04 5.000000000000000000e+04 8.000000000000000000e+05 7.000000000000000000e+03 3.000000000000000000e+05
9.800000000000000000e+03 5.100000000000000000e+04 8.240000000000000000e+05 7.420000000000000000e+03 3.030000000000000000e+05
9.604000000000000000e+03 5.202000000000000000e+04 8.487200000000000000e+05 7.865200000000000728e+03 3.060300000000000000e+05
9.411920000000000073e+03 5.306040000000000146e+04 8.741815999999999767e+05 8.337112000000000990e+03 3.090902999999999884e+05
9.223681599999999889e+03 5.412160800000000017e+04 9.004070479999999516e+05 8.837338720000001558e+03 3.121812029999999795e+05
9.039207968000000619e+03 5.520404016000000411e+04 9.274192594399999361e+05 9.367579043200001252e+03 3.153030150300000096e+05
8.858423808640000061e+03 5.630812096320000273e+04 9.552418372232000111e+05 9.929633785792002527e+03 3.184560451803000178e+05
8.681255332467200788e+03 5.743428338246400381e+04 9.838990923398960149e+05 1.052541181293952286e+04 3.216406056321030483e+05
8.507630225817856626e+03
@kenjisato
kenjisato / daylight.xlsx
Last active April 27, 2022 15:11
2022-04-26 ゼミ資料
@kenjisato
kenjisato / macro1_important_notice.md
Created April 19, 2022 01:47
Macroeconomics 1 Notice

マクロ1: 配布物と教科書,授業に関する考え方

授業の出席と同様に,動画の視聴は必須ではありません。私は誰が何分視聴したかの記録を取りません。 ただ,配布スライドと授業・動画用に作っているスライドには少しだけ違いがあるということには注意をしておいてください。 したがって,動画視聴にもそれなりのメリットがあります。

配布物,教科書,授業との間で生じる差分に関する考え方を説明しておきます。

配布スライドに書いていないけど授業・動画で説明していること。

#' Include an image not produced in Rmd/Rnw file.
#'
#' @param image_file character. image file name. Typically, PNG JPEG or SVG file.
#' @param html_opts list. list of \code{alt} and \code{width}.
#' Used as alt/width attributes for the image tag.
#' @param latex_opts list. list of parameters passed to \\includegraphics[]{image_file}
#'
#' @return LaTeX/Markdown code embedded in Rmd/Rnw file.
#' @export
include_graphics <- function(image_file, html_opts = NULL, latex_opts = NULL) {
.bordered-table table {
border-collapse: collapse;
border-spacing: 0;
border:1px solid rgba(0, 0, 0, 1);
}
.bordered-table th {
border:1px solid rgba(0, 0, 0, 1);
}
.bordered-table tbody tr:nth-child(odd) {
background-color: rgba(242,242,242, 0.8);
```{r}
N <- 3
mountains <-
data.frame(
Mountain = c("Everest", "K2", "Kangchenjunga", "Lhotse", "Makalu",
"Cho Oyu", "Dhaulagiri", "Manaslu"),
`Height (m)` = c(8848, 8611, 8586, 8516, 8485, 8188, 8167, 8163),
check.names = FALSE
)
@kenjisato
kenjisato / table-style.html
Last active August 5, 2021 06:22
Bordered table CSS
<style type="text/css" rel="stylesheet">
.bordered-table {
border-collapse: collapse;
border-spacing: 0;
border:1px solid #000000;
}
.bordered-table th {
border:1px solid #000000;
}
.bordered-table td{
@kenjisato
kenjisato / graphics.R
Created February 2, 2020 08:33
PDF/HTML graphics
include_graphics <- function(path, image_opts = NULL, pdf_opts = NULL) {
sys_call <- sys.calls()
produce_pdf <- sapply(c('exams2pdf', 'exams2nops'),
function(x) any(grepl(x, sapply(sys_call, deparse))))
if (any(produce_pdf)){
path_to_pdf <- paste0(tools::file_path_sans_ext(path), '.pdf')
if (file.exists(path_to_pdf)){
pdf_options <- if (!is.null(pdf_opts)) {
@kenjisato
kenjisato / swisscapital-param.Rmd
Created December 3, 2019 00:37
Parameterized xweave, an idea
```{r eval=is.null(params), echo=FALSE}
n <- 5
```
```{r, include=FALSE}
alternatives <- tibble::tribble(
~answer, ~correct, ~solution,
# 1
"Zurich is the capital of Switzerland.", FALSE,
@kenjisato
kenjisato / check_daten.R
Created October 17, 2019 21:57
A shiny gadget to check Daten.txt
library(shiny)
library(miniUI)
library(DT)
#'
#' A shiny gadget to check and fix Daten.txt
#'
check_daten <- function(dir, file = "Daten.txt", width = 800, height = 600, n = 45) {
daten <- read.delim(file.path(dir, file),
sep = " ", header = FALSE, colClasses = "character"