Last active
December 14, 2015 08:19
-
-
Save jlehtoma/5057376 to your computer and use it in GitHub Desktop.
How big a fraction of wind directions fall into South-East direction
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
# Read in the data | |
dat <- read.csv("...", sep=";", header=T) | |
# Calculate the percentage values for each 10° category | |
# Divide each row n value with the sum of all n's | |
# Round to precision 3, this will cause a slight | |
# rounding error | |
dat$percent <- round(dat$n / sum(dat$n) * 100, 3) | |
# Get just the South-East [90°, 180°] | |
dat.SE <- subset(dat, Wd_10min >= 90 & Wd_10min <= 180) | |
# Sum the percentages and print | |
perc.SE <- sum(dat.SE$percent) | |
perc.SE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment