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
Chapter 1: R Intro | |
https://schmidtpaul.github.io/dsfair_quarto/rbasics/firststeps.html | |
Chapter 2: Tidyverse | |
https://schmidtpaul.github.io/dsfair_quarto/rbasics/tidyverse.html | |
Chapter 3: Correlation & Regression | |
https://schmidtpaul.github.io/dsfair_quarto/rbasics/correlation_regression.html | |
Chapter 4: Bad Data & Outlier |
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
[ | |
{ | |
"cmd": "Py", | |
"act": "Python Code Assistant", | |
"prompt": "You are my Python Code Assistant. Whenever you help me with Python code, I want the following things: Never tell me to or show me how to install and/or load a module. Instead, skip right to the actual code. 2. Never reproduce a array/dataframe etc. that I pasted unless I explicitly ask you to. Instead, skip right to the actual code where you can refer to any of my arrays/dataframes either with their name or - if no name was provided - with dummy names like `your_array`. 3. Make use of numpy, pandas and piping. 4. I dont care whether you actually run python code or not, however the answer must always be Python code which I can easily copy-paste 5. Always immediately start with the code. Any additional explanations should be written at the very end of your response.", | |
"enable": true | |
}, | |
{ | |
"cmd": "R", | |
"act": "R Code Assistant", |
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
You are my R Code Assistant. Whenever you help me with R code, I want the following things: 1. Never tell me to or show me how to install and/or load a package. Instead, skip right to the actual code. 2. Never reproduce a table/vector etc. that I pasted unless I explicitly ask you to. Instead, skip right to the actual code where you can refer to any of my tables/vectors either with their name or - if no name was provided - with dummy names like `your_table`. 3. Make use of the tidyverse and pipes (%>%). If applicable and advantageous, also make use of {lubridate}, {purrr} and/or {scales}. 4. Always immediately start with the code. Any additional explanations should be written at the very end of your response. |
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: "Run SAS in R" | |
author: Dr. Paul Schmidt, BioMath GmbH | |
output: word_document | |
--- | |
```{r, include = FALSE} | |
library(SASmarkdown) | |
knitr::opts_chunk$set( | |
engine = "sas", |
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
# inspiration: https://albert-rapp.de/post/2021-12-31-ggforce-examples/ | |
library(ggforce) | |
library(tidyverse) | |
set.seed(42) | |
tibble(x = runif(1000), y = runif(1000)) %>% | |
ggplot(aes(x, y)) + | |
geom_voronoi_tile(aes(fill = y)) + |
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(tidyverse) | |
# data -------------------------------------------------------------------- | |
dat <- tibble( | |
x = c("A", "A", "B", "B"), | |
y = c(12, 11, 13.03, 13), | |
grp = c("G1", "G2", "G1", "G2"), | |
lab = c("a", "abc", "ab", "abcd") | |
) %>% | |
mutate_if(is.character, as.factor) |
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
# taken from youtube tutorial: https://youtu.be/hPTBZelmAh4 | |
library(showtext) | |
library(ggplot2) | |
font_add(family = "ComicSansMS", regular = "Comic.ttf") | |
showtext_auto() | |
labeldata <- data.frame(mylabel = "geom_text font\nmust be changed\nseparately like this", | |
group = 1.5, |
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(dlookr) | |
library(tidyverse) | |
dat <- mtcars %>% | |
transmute(Cyl = as.factor(cyl), | |
Am = as.factor(am), | |
hp = hp) | |
bind_rows( | |
dat %>% describe(hp), |
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
/*******************************************************************************************************/ | |
/* First time setup: */ | |
/* You must take one manual step before your SAS can run R-Code: Edit the SAS-config-file (sasv9.cfg). */ | |
/* To locate this file on your PC, you can run the following code in SAS and it will return the */ | |
/* path to the SAS-config-file in the log: */ | |
/* proc options option=config; run; */ | |
/* It will possibly be: C:\Program Files\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg */ | |
/* Find that file and edit it as shown in this video at 1:10min (i.e. add '-RLANG') */ | |
/* https://www.youtube.com/watch?v=3pbXUthE1As&t=110s */ | |
/* If Windows does not allow you to save/overwrite the file after edi |
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
# This function exports plots. It always creates a pdf and can additionally | |
# create png files (defaults: create_png = TRUE; ). You provide the | |
# folder_path and the file_name and by default both folder_path/file_name.pdf | |
# and folder_path/file_name.png will be created. | |
# | |
# You may immediately preview the created files by automatically having them | |
# opened on your computer after being created (defaults: open_pdf = FALSE; | |
# open_png = TRUE). | |
# | |
# The pdf is exported via ggplot2::ggsave(), but the png is not! Instead, |
NewerOlder