We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 23 columns, instead of 14. in line 8.
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
country,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011 | |
Abkhazia,,,,,,,,,,,,,,,,,,,,,, | |
Afghanistan,0,,,,,,,,,,,0.004188346,0.004092114,0.079875078,0.097163516,1.130397829,1.947423469,1.751202161,1.688485448,3.246305573,3.654114396,4.580669921 | |
Akrotiri and Dhekelia,,,,,,,,,,,,,,,,,,,,,, | |
Albania,0,,,,,0.011168695,0.032196828,0.048593919,0.06502737,0.081437045,0.114097347,0.325798377,0.390081273,0.971900415,2.420387798,6.043890864,9.609991316,15.03611541,23.86,41.2,45,49 | |
Algeria,0,,,,0.000360674,0.001768954,0.001738533,0.010268463,0.020238555,0.199523843,0.491705679,0.646114017,1.59164126,2.195359731,4.634475088,5.843942092,7.375984956,9.451190626,10.18,11.23,12.5,14 | |
American Samoa,0,,,,,,,,,,,,,,,,,,,,, | |
Andorra,0,,,,,,1.526601023,3.050175385,6.886209218,7.635686143,10.53883561,,11.26046872,13.54641288,26.83795439,37.60576622,48.936847,70.87,70.04,78.53,81,81 | |
Angola,0,,,,,,0.000775929,0.005673746,0.018453724,0.071964087,0.105045562,0.136013867,0.27037 |
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) # code uses development version of ggplot2 for viridis scales; otherwise, viridis package would be needed | |
df_internet <- read.csv("internet.csv") | |
# sort countries by internet users in final year | |
internet_summary <- df_internet %>% | |
group_by(country) %>% | |
summarize(last = users[n()]) %>% | |
arrange(last) |
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(rlang) | |
# Functions with names ending in `_impl` take quoted expressions as input. | |
# This removes the need for constant quoting and unquoting | |
simplify_sum_impl <- function(e1, e2) { | |
if (is_syntactic_literal(e1) & is_syntactic_literal(e2)) { | |
return(eval_bare(e1 + e2)) | |
} | |
if (e1 == 0) { |
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(purrr) | |
library(ggplot2) | |
# function that does the work | |
make_partial_plots <- function(p) { | |
g <- ggplot_build(p) | |
n <- length(g$plot$layers) | |
blank_out <- function(i) { | |
g1 <- g |
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
# original version | |
library(DAAG) | |
library(ggplot2) | |
library(ggridges) | |
ggplot(ais, aes(x=ht, y=sport, point_size=pcBfat, point_color=sex, group=sport)) + | |
geom_density_ridges(jittered_points=TRUE, scale = .8, rel_min_height = .01, fill = "gray90", | |
points_scaling_range = c(.1, .8)) + | |
scale_y_discrete(expand = c(.01, 0)) + | |
scale_x_continuous(expand = c(0, 0), name = "height [cm]") + | |
scale_point_size_continuous(range = c(0.1, 5), name = "% bodyfat") + |
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(multiscales) | |
colors <- scales::colour_ramp( | |
colors = c(red = "#AC202F", purple = "#740280", blue = "#2265A3") | |
)((0:7)/7) | |
types <- c( | |
'Natural state geometry', | |
'Cartogram weigted by electoral votes' |
We can't make this file beautiful and searchable because it's too large.
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
sasdate,RPI,W875RX1,DPCERA3M086SBEA,CMRMTSPLx,RETAILx,INDPRO,IPFPNSS,IPFINAL,IPCONGD,IPDCONGD,IPNCONGD,IPBUSEQ,IPMAT,IPDMAT,IPNMAT,IPMANSICS,IPB51222S,IPFUELS,CUMFNS,HWI,HWIURATIO,CLF16OV,CE16OV,UNRATE,UEMPMEAN,UEMPLT5,UEMP5TO14,UEMP15OV,UEMP15T26,UEMP27OV,CLAIMSx,PAYEMS,USGOOD,CES1021000001,USCONS,MANEMP,DMANEMP,NDMANEMP,SRVPRD,USTPU,USWTRADE,USTRADE,USFIRE,USGOVT,CES0600000007,AWOTMAN,AWHMAN,HOUST,HOUSTNE,HOUSTMW,HOUSTS,HOUSTW,PERMIT,PERMITNE,PERMITMW,PERMITS,PERMITW,AMDMNOx,AMDMUOx,BUSINVx,ISRATIOx,M1SL,M2SL,M2REAL,AMBSL,TOTRESNS,NONBORRES,BUSLOANS,REALLN,NONREVSL,CONSPI,S&P 500,S&P: indust,S&P div yield,S&P PE ratio,FEDFUNDS,CP3Mx,TB3MS,TB6MS,GS1,GS5,GS10,AAA,BAA,COMPAPFFx,TB3SMFFM,TB6SMFFM,T1YFFM,T5YFFM,T10YFFM,AAAFFM,BAAFFM,EXSZUSx,EXJPUSx,EXUSUKx,EXCAUSx,WPSFD49207,WPSFD49502,WPSID61,WPSID62,OILPRICEx,PPICMM,CPIAUCSL,CPIAPPSL,CPITRNSL,CPIMEDSL,CUSR0000SAC,CUSR0000SAD,CUSR0000SAS,CPIULFSL,CUSR0000SA0L2,CUSR0000SA0L5,PCEPI,DDURRG3M086SBEA,DNDGRG3M086SBEA,DSERRG3M086SBEA,CES0600000008,CES2000000008,CES300 |
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) | |
library(sf) | |
# Development version of colorspace is needed. Install via: | |
# install.packages("colorspace", repos = "http://R-Forge.R-project.org") | |
library(colorspace) | |
crs_goode <- "+proj=igh" | |
world_goode <- st_as_sf(rworldmap::getMap(resolution = "low")) %>% |
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 file implements the 2D isoline and isoband algorithms described | |
// here: https://en.wikipedia.org/wiki/Marching_squares | |
// Written by Claus O. Wilke | |
#include <Rcpp.h> | |
using namespace Rcpp; | |
#include <iostream> | |
#include <vector> | |
#include <utility> // for pair |
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 for presentation at rstudio::conf2019 | |
# Slides: | |
# https://docs.google.com/presentation/d/1zMuBSADaxdFnosOPWJNA10DaxGEheW6gDxqEPYAuado/edit?usp=sharing | |
# Setup ------------------------------------------------------------------- | |
library(ggplot2) | |
library(gganimate) | |
library(ungeviz) | |
library(mgcv) |
OlderNewer