This file contains hidden or 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
| #' Description | |
| #' This file runs a live election-night forecast based on The Economist's pre-election forecasting model | |
| #' available at projects.economist.com/us-2020-forecast/president. | |
| #' It is resampling model based on https://pkremp.github.io/update_prob.html. | |
| #' This script does not input any real election results! You will have to enter your picks/constraints manually (scroll to the bottom of the script). | |
| #' | |
| #' Licence | |
| #' This software is published by *[The Economist](https://www.economist.com)* under the [MIT licence](https://opensource.org/licenses/MIT). The data generated by *The Economist* are available under the [Creative Commons Attribution 4.0 International License](https://creativecommons.org/licenses/by/4.0/). | |
| #' The licences include only the data and the software authored by *The Economist*, and do not cover any *Economist* content or third-party data or content made available using the software. More information about licensing, syndication and the copyright of *Economist* content can be fou |
This file contains hidden or 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) | |
| data <- data.frame(a = c(rnorm(100,1,0.1),rnorm(10,1.2,0.2)), | |
| b = c(rnorm(100,8,2),rnorm(10,13,2)), | |
| c = c(rep("Group1",100),rep("Group2",10))) | |
| data$c_dummy = ifelse(data$c == "Group1",0.5,1.5) | |
| ggplot(data,aes(x=c_dummy,y=a,group=c)) + | |
| geom_boxplot() + |
This file contains hidden or 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) | |
| # using expression() for the text formatting: | |
| ggplot(mtcars, | |
| aes(disp, | |
| mpg)) + | |
| geom_point() + | |
| # ~ for spaces, and * for no-space between (unquoted) expressions | |
| ylab(expression(Anthropogenic~SO[4]^{"2-"}~(ngm^-3))) + | |
| xlab(expression(italic(delta)^13*C[ap]*"‰")) + |
This file contains hidden or 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: "Adding arrows to PCoA" | |
| author: "Matthias Grenié" | |
| date: "26 septembre 2018" | |
| output: pdf_document | |
| --- | |
| ```{r setup, include=FALSE} | |
| knitr::opts_chunk$set(echo = TRUE) | |
| ``` |
This file contains hidden or 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
| # ========================================================================== | |
| # Example of plot for publication with inwards ticks in ggplot | |
| # ========================================================================== | |
| library(ggplot2) | |
| # ================================== | |
| # create some data | |
| # ================================== | |
| set.seed(1) |
This file contains hidden or 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(dplyr) | |
| library(tidyr) | |
| library(ggplot2) | |
| library(animation) | |
| #Data from https://crudata.uea.ac.uk/cru/data/temperature/ | |
| #As well as data read in script | |
| source("read_cru_hemi.R") | |
| temp_dat <- read_cru_hemi("./HadCRUT4-gl.dat") | |
| #remove cover |
This file contains hidden or 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
| #' Bagplot | |
| #' | |
| #' The bag geom is useful for graphical summaries of scatterplots. It | |
| #' is effective at showing the location, spread, skewness, and | |
| #' outliers of a data set. | |
| #' | |
| #' A bagplot is a bivariate generalization of the well known boxplot. It | |
| #' was proposed by Rousseeuw, Ruts, and Tukey. This geom plots bagplots that | |
| #' are very similar to the one described in Rousseeuw et al. and | |
| #' uses code from their bagplot functions in the aplpack pacakge. |