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
| # x is a dataset, and one wants to construct a new dataset created by x minus the 5 "quartiles", | |
| # being 0%, 25%, 50%, 75% and 100% quantiles. | |
| # This constructs the data | |
| x <- rnorm(1e6) | |
| quart <- quantile(x) | |
| # The original code of one of my students. I loathed two things: | |
| # - the use of a for loop when one could use outer() | |
| # - the growing of an object | |
| oorspronkelijk <- function(x, quart){ |
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
| # Calculation of hurricane damage as percentage of | |
| # real GDP in the US. | |
| # The data: | |
| # damage taken from: | |
| # https://www.wunderground.com/cat6/2017-us-hurricane-damages-206-billion-highest-record | |
| # real GDP taken from | |
| # https://fred.stlouisfed.org/series/GDPCA | |
| year <- c(2017,1893,2005,1928,1960,2012,1969,1947,1954,1945) | |
| # damage in billion of dollars, adjusted to 2017 dollars |
NewerOlder