Skip to content

Instantly share code, notes, and snippets.

View graebnerc's full-sized avatar

Claudius Graebner-Radkowitsch graebnerc

View GitHub Profile
@graebnerc
graebnerc / solution.R
Created March 24, 2022 15:11
Solution to the exercise of session 3 in the Data Science course at the EUF. The task was to write a function that normalizes numeric vectors into the range of zero and one.
#' Normalize a numeric vector into zero-one-range
#'
#' This simple function covers simple cases: when you have a vector of numbers
#' larger or equal to zero, then this function normalizes these numbers into
#' the range between zero and one.
#' @param input_vector A vector of numeric values greater or equal to zero
#' @return A vector of the same length as `input_vector`, the elements are
#' normalized into the range between zero and one
normalize_vector <- function(input_vector){
min_max_diff <- max(input_vector) - min(input_vector)
@graebnerc
graebnerc / DesasterMarkdown.Rmd
Created March 24, 2022 17:37
The original code for the desaster markdown file, as well as a corrected version
---
title: "What a desaster!"
author: "Claudius"
date: '2022-04-06'
output: pdf_document
---
# Packages used
```{r}
library(tidyverse)
@graebnerc
graebnerc / T4-ExerciseSolution
Created March 31, 2022 12:19
Solutions to the intermediate exercises of T4 of the data science course in the spring semester 2022
# T4: Intermediate exercises and possible solutions
# I. Create a vector with the numbers from -2 to 19 (step size: 0.75)
ex_1 <- seq(from=-2, to=19, by=0.75)
ex_1
# II. Create an index vector for this first vector (note: an index vector is a
# vector with all possible indices of the original vector)
ex_1_index <- seq(1, length(ex_1))
ex_1_index
@graebnerc
graebnerc / T5-SessionNotes
Created April 6, 2022 11:53
Session Script T5, Advanced object types (April 6, 2022)
# Session Script T5, Advanced object types (April 6, 2022)
# Factors - Slide 10
f_1 <- factor(c(rep("F", 2), rep("M", 3), rep("D", 3)),
levels = c("D", "F", "M"))
f_1
f_2 <- factor(c(rep("F", 2), rep("M", 3), rep("D", 3)))
f_2
@graebnerc
graebnerc / index.Rmd
Created April 6, 2022 12:36
A possible solution to the R-Markdown exercise
---
title: "A possible solution"
author: "Claudius"
date: "4/6/2022"
output:
html_document:
toc: yes
toc_float: yes
code_download: yes
theme: "spacelab"
@graebnerc
graebnerc / beer_violins.R
Created April 9, 2022 06:18
Creating the descriptive violin plot for the beer data set, as used in the session on linear regression.
library(ggplot2)
library(tidyr)
library(dplyr)
library(DataScienceExercises) # https://github.com/graebnerc/DataScienceExercises/
beer_data <- DataScienceExercises::beer
# Original source: http://www.principlesofeconometrics.com/poe4/poe4stata.htm
beer_data_plot <- beer_data %>%
pivot_longer(
cols = everything(),
@graebnerc
graebnerc / #T8: Lecture notes
Last active May 5, 2022 09:16
T8: Lecture notes
Lecture notes and solutions to the exercises of session 8 on data wrangling
@graebnerc
graebnerc / #MCS-Tutorial exercises
Last active May 6, 2022 20:25
Solutions to the MCS tutorial exercises
Solutions to the exercises that are mentioned in the tutorial on Monte Carlo Simulations.
@graebnerc
graebnerc / #Reboundeffekt im Wohnbereich
Created May 17, 2022 14:05
Replikation der Abbildung zum Rebound Effekt im Wohnsektor
Code zur Replikation der Abbildung im Blogbeitrag "Zur ökonomischen Bedeutung des Genugs: Warum Suffizienz ein größere Rolle in den Wirtschaftswissenschaften spielen sollte"
Die Rohdaten (`Datensatz Daten_Wohnflaeche_Rebound.xlsx`) sind aus den im Blog verlinkten Quellen entnommen und können von Frauke Wiese angefordert werden.
Lecture notes and solutions to the exercises of session 11 and 12 on linear models