flowchart TD A[원본 데이터] --> B[분석 코드] B --> C[결과] C --> D[보고서/논문] D --> E[재현 검증] E --> F[신뢰성 확보] style A fill:#e1f5fe style B fill:#f3e5f5 style C fill:#e8f5e8 style D fill:#fff3e0 style E fill:#fce4ec style F fill:#e0f2f1
정적 사이트 생성기를 활용한 재현 가능한 연구 워크플로우
4/1/14
재현 가능한 연구 (Reproducible Research)
flowchart TD A[원본 데이터] --> B[분석 코드] B --> C[결과] C --> D[보고서/논문] D --> E[재현 검증] E --> F[신뢰성 확보] style A fill:#e1f5fe style B fill:#f3e5f5 style C fill:#e8f5e8 style D fill:#fff3e0 style E fill:#fce4ec style F fill:#e0f2f1
연구 재현성의 위기
최근 연구에 따르면, 많은 과학 연구들이 재현되지 않는 문제가 대두되고 있습니다. 특히 심리학, 의학, 경제학 분야에서 이러한 문제가 심각합니다.
Jekyll은 Ruby 기반의 정적 사이트 생성기
flowchart LR A[Markdown 파일] --> B[Jekyll 엔진] C[YAML 설정] --> B D[템플릿] --> B B --> E[HTML 사이트] style A fill:#e3f2fd style B fill:#f3e5f5 style C fill:#e8f5e8 style D fill:#fff3e0 style E fill:#fce4ec
flowchart TD A[연구 계획] --> B[Jekyll 사이트 설정] B --> C[데이터 수집] C --> D[분석 코드 작성] D --> E[결과 문서화] E --> F[사이트 업데이트] F --> G[GitHub 커밋] G --> H[자동 배포] H --> I[결과 공유] J[동료 검토] --> K[피드백 반영] K --> D style A fill:#e1f5fe style B fill:#f3e5f5 style C fill:#e8f5e8 style D fill:#fff3e0 style E fill:#fce4ec style F fill:#e0f2f1 style G fill:#f1f8e9 style H fill:#fef7e0 style I fill:#fce4ec
research-project/
├── _config.yml # Jekyll 설정
├── _data/ # 데이터 파일
│ ├── datasets.yml
│ └── parameters.yml
├── _includes/ # 재사용 가능한 컴포넌트
│ ├── header.html
│ └── footer.html
├── _layouts/ # 페이지 레이아웃
│ ├── default.html
│ └── post.html
├── _posts/ # 연구 로그/블로그
│ └── 2024-01-15-analysis-results.md
├── _sass/ # 스타일시트
├── assets/ # 이미지, CSS, JS
├── data/ # 원본 데이터
├── scripts/ # 분석 스크립트
├── results/ # 분석 결과
└── index.md # 홈페이지
**_config.yml**
title: "My Research Project"
description: "재현 가능한 연구 프로젝트"
author: "연구자 이름"
email: "researcher@example.com"
# GitHub 정보
github_username: yourusername
repository: your-repo-name
# 빌드 설정
markdown: kramdown
highlighter: rouge
theme: minima
# 플러그인
plugins:
- jekyll-feed
- jekyll-sitemap
- jekyll-seo-tag
# 제외할 파일
exclude:
- README.md
- Gemfile
- Gemfile.lock
연구 페이지 생성
---
layout: default
title: "연구 개요"
---
# 연구 제목: 데이터 분석을 통한 사용자 행동 패턴 분석
## 연구 목적
이 연구는 웹사이트 사용자의 행동 패턴을 분석하여...
## 연구 방법
1. 데이터 수집: Google Analytics API 활용
2. 전처리: Python pandas 라이브러리 사용
3. 분석: R을 이용한 통계 분석
4. 시각화: ggplot2와 D3.js 활용
## 주요 결과
- 사용자 세션 시간 평균: 3분 42초
- 페이지 이탈률: 45.2%
- 모바일 사용자 비율: 68.4%
분석 결과 페이지
---
layout: default
title: "분석 결과"
---
# 분석 결과
## 데이터 개요
- 분석 기간: 2024년 1월 - 3월
- 총 데이터 수: 10,000건
- 분석 도구: R 4.3.0, Python 3.9
## 주요 발견사항
### 1. 사용자 행동 패턴
{% include_relative results/user_behavior_chart.html %}
### 2. 시간별 접속 패턴

### 3. 통계적 유의성 검증
- p-value: 0.0032 (< 0.05)
- 신뢰구간: 95%
- 효과 크기: 0.67 (중간 크기)
## 코드 재현
분석에 사용된 모든 코드는 [GitHub 저장소](https://github.com/username/repo)에서 확인할 수 있습니다.
1. 저장소 생성 - GitHub에서 새 저장소 생성 - 저장소명: username.github.io
또는 프로젝트명 - Public으로 설정
2. 로컬 연결
3. Pages 활성화 - Settings → Pages - Source: Deploy from a branch - Branch: main / (root) - Save
4. 자동 배포 - 코드 변경 시 자동으로 사이트 업데이트 - 보통 1-2분 내에 반영 - https://username.github.io/repo 에서 확인
.github/workflows/jekyll.yml
name: Build and Deploy Jekyll Site
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0
bundler-cache: true
- name: Build Jekyll site
run: bundle exec jekyll build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_site
<!-- _includes/d3_chart.html -->
<div id="chart"></div>
<script src="https://d3js.org/d3.v7.min.js"></script>
<script>
// D3.js 차트 코드
const data = {{ site.data.analysis_results | jsonify }};
const svg = d3.select("#chart")
.append("svg")
.attr("width", 600)
.attr("height", 400);
// 차트 구현...
</script>
<!-- _includes/plotly_chart.html -->
<div id="plotly-chart"></div>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<script>
const data = [
{
x: {{ site.data.chart_data.x | jsonify }},
y: {{ site.data.chart_data.y | jsonify }},
type: 'scatter'
}
];
Plotly.newPlot('plotly-chart', data);
</script>
데이터 파일 활용
# _data/experiments.yml
- name: "실험 1"
date: "2024-01-15"
status: "완료"
results:
- metric: "정확도"
value: 0.87
- metric: "재현율"
value: 0.92
- name: "실험 2"
date: "2024-01-20"
status: "진행중"
results: []
템플릿에서 활용
{% for experiment in site.data.experiments %}
<div class="experiment">
<h3>{{ experiment.name }}</h3>
<p>날짜: {{ experiment.date }}</p>
<p>상태: {{ experiment.status }}</p>
{% if experiment.results.size > 0 %}
<h4>결과:</h4>
{% for result in experiment.results %}
<p>{{ result.metric }}: {{ result.value }}</p>
{% endfor %}
{% endif %}
</div>
{% endfor %}
Gemfile
source "https://rubygems.org"
gem "jekyll", "~> 4.3"
gem "jekyll-feed"
gem "jekyll-sitemap"
gem "jekyll-seo-tag"
gem "jekyll-scholar" # 학술 인용
gem "jekyll-jupyter-notebook" # Jupyter 노트북 지원
gem "jekyll-mermaid" # 다이어그램
gem "jekyll-toc" # 목차 자동 생성
group :jekyll_plugins do
gem "jekyll-timeago"
gem "jekyll-paginate"
end
팁: README 파일 작성
각 디렉토리에 README.md 파일을 작성하여 해당 폴더의 내용과 사용법을 설명하세요.
분석 스크립트 구조
scripts/
├── 01_data_collection.py # 데이터 수집
├── 02_data_cleaning.R # 데이터 전처리
├── 03_exploratory_analysis.py # 탐색적 분석
├── 04_statistical_analysis.R # 통계 분석
├── 05_visualization.py # 시각화
└── utils/ # 유틸리티 함수
├── data_utils.py
└── plot_utils.R
각 스크립트의 구조
#!/usr/bin/env python3
"""
데이터 수집 스크립트
작성자: 홍성학
작성일: 2024-01-15
목적: API를 통한 사용자 행동 데이터 수집
"""
import pandas as pd
import requests
from datetime import datetime
# 설정
API_KEY = "your_api_key"
BASE_URL = "https://api.example.com"
def collect_data(start_date, end_date):
"""데이터 수집 함수"""
# 구현 내용...
pass
if __name__ == "__main__":
# 실행 코드
data = collect_data("2024-01-01", "2024-03-31")
data.to_csv("../data/raw_data.csv", index=False)
print(f"데이터 수집 완료: {len(data)} 건")
데이터 관리 - [ ] 원본 데이터 보존 - [ ] 데이터 출처 명시 - [ ] 전처리 과정 문서화 - [ ] 데이터 딕셔너리 작성
코드 관리 - [ ] 버전 관리 시스템 사용 - [ ] 코드 주석 작성 - [ ] 함수와 모듈 분리 - [ ] 테스트 코드 작성
환경 관리 - [ ] 의존성 목록 작성 - [ ] 가상 환경 설정 - [ ] 실행 환경 문서화 - [ ] Docker 컨테이너 고려
문서화 - [ ] README 파일 작성 - [ ] 분석 보고서 작성 - [ ] 결과 해석 포함 - [ ] 한계점 명시
Jekyll의 장점 - 간단한 설정과 사용법 - GitHub Pages 무료 호스팅 - 마크다운 기반 쉬운 작성 - 풍부한 플러그인 생태계 - 버전 관리 통합
연구에서의 활용 - 연구 과정 투명화 - 결과 공유 및 협업 - 지속적인 업데이트 - 동료 검토 용이성
다음 단계 1. 본인의 연구 프로젝트에 적용 2. 팀원들과 워크플로우 공유 3. 고급 기능들 점진적 도입 4. 커뮤니티 피드백 수집
유용한 자료 - Jekyll 공식 문서 - GitHub Pages 가이드 - Jekyll 테마 모음
질문이 있으시면 언제든지 연락주세요
euriion@gmail.com
github.com/euriion
linkedin.com/in/euriion
이 슬라이드도 Jekyll로 만들어졌습니다!
Reproducible Research with Jekyll | 홍성학