Instantly share code, notes, and snippets.

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.
View solution.R
This file contains 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
 #' 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)
Created March 24, 2022 17:37
The original code for the desaster markdown file, as well as a corrected version
View DesasterMarkdown.Rmd
This file contains 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
 --- title: "What a desaster!" author: "Claudius" date: '2022-04-06' output: pdf_document --- # Packages used ```{r} library(tidyverse)
Created March 31, 2022 12:19
Solutions to the intermediate exercises of T4 of the data science course in the spring semester 2022
View T4-ExerciseSolution
This file contains 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
 # 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
Created April 6, 2022 11:53
Session Script T5, Advanced object types (April 6, 2022)
View T5-SessionNotes
This file contains 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
 # 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
Created April 6, 2022 12:36
A possible solution to the R-Markdown exercise
View index.Rmd
This file contains 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
 --- title: "A possible solution" author: "Claudius" date: "4/6/2022" output: html_document: toc: yes toc_float: yes code_download: yes theme: "spacelab"
Created April 9, 2022 06:18
Creating the descriptive violin plot for the beer data set, as used in the session on linear regression.
View beer_violins.R
This file contains 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(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(),
Last active May 5, 2022 09:16
T8: Lecture notes
View #T8: Lecture notes
This file contains 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
 Lecture notes and solutions to the exercises of session 8 on data wrangling
Last active May 6, 2022 20:25
Solutions to the MCS tutorial exercises
View #MCS-Tutorial exercises
This file contains 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
 Solutions to the exercises that are mentioned in the tutorial on Monte Carlo Simulations.
Created May 17, 2022 14:05
Replikation der Abbildung zum Rebound Effekt im Wohnsektor
View #Reboundeffekt im Wohnbereich
This file contains 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
 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.
Created June 1, 2022 14:11
View #T11: lecture notes
This file contains 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
 Lecture notes and solutions to the exercises of session 11 and 12 on linear models