The offshore wind potential data evaluates the technical feasibility of building offshore wind and divides the data into fixed and floating turbines. Floating turbines are typically more expensive and utilized in deeper water where fixed turbines are not feasible.
Is there a relationship in offshore wind potential between fixed and floating turbines?
knitr::opts_chunk$set(echo = TRUE)
setwd('C:\\Users\\koselh\\Desktop\\RData\\Exercise_6')
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(readr)
library(ggplot2)
library(ggthemes)
library(ggpubr)
library(tidyr)
osw <- read_csv("osw.csv")
## Rows: 179 Columns: 5
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (5): GeoName, Territory, Sovereign, Fixed, Float
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#convert from character to numeric data
osw <- osw %>%
mutate_at(c("Fixed", "Float"), as.numeric)
## Warning: There were 2 warnings in `mutate()`.
## The first warning was:
## ℹ In argument: `Fixed = .Primitive("as.double")(Fixed)`.
## Caused by warning:
## ! NAs introduced by coercion
## ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#remove NA's
clean_osw <- osw %>%
drop_na(Fixed, Float)
summary(clean_osw)
## GeoName Territory Sovereign Fixed
## Length:153 Length:153 Length:153 Min. : 0.001
## Class :character Class :character Class :character 1st Qu.: 1.258
## Mode :character Mode :character Mode :character Median : 12.372
## Mean : 133.194
## 3rd Qu.: 59.847
## Max. :5558.035
## Float
## Min. : 0.057
## 1st Qu.: 8.344
## Median : 37.751
## Mean : 309.449
## 3rd Qu.: 169.039
## Max. :7815.123
highest_pot_fix <- clean_osw %>%
arrange(desc(Fixed)) %>%
slice(1:5)
#print table of top 5 countries fixed OSW potential
knitr::kable(head(highest_pot_fix, 10))
| GeoName | Territory | Sovereign | Fixed | Float |
|---|---|---|---|---|
| Russian Exclusive economic Zone | Russia | Russia | 5558.035 | 7815.123 |
| United States Exclusive Economic Zone | United States | United States | 2472.353 | 2786.815 |
| Canadian Exclusive Economic Zone | Canada | Canada | 2038.826 | 7281.991 |
| Australian Exclusive Economic Zone | Australia | Australia | 1572.193 | 3391.359 |
| Chinese Exclusive Economic Zone | China | China | 1321.152 | 1108.120 |
# Scatter plot
ggplot(clean_osw, aes(x = Fixed, y = Float)) +
geom_point(na.rm=TRUE,color = "blue", size = 3) +
labs(title = "Relationship Between Fixed and Floating OSW Potential (>100 GW)", x = "Fixed (GW)", y = "Floating (GW)") +
theme_minimal()+
theme_tufte()+
xlim(0,100) +
ylim(0,100)+
theme(plot.title = element_text(hjust = 0.7))+
geom_smooth(method = "lm") + # Add a linear trend line
stat_regline_equation(label.x = 80, label.y = 90) + # Add the regression equation
stat_cor(aes(label = ..rr.label..), label.x = 85, label.y = 80) # Add the R-squared value
## Warning: The dot-dot notation (`..rr.label..`) was deprecated in ggplot2 3.4.0.
## ℹ Please use `after_stat(rr.label)` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 57 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 57 rows containing non-finite outside the scale range
## (`stat_regline_equation()`).
## Warning: Removed 57 rows containing non-finite outside the scale range
## (`stat_cor()`).
After evaluating the data there is not a strong relationship between a countries fixed and floating OSW potential. The trendline for countries with at least 100 GW of OSW potential is 0.39 which represents a weak relationship and the data further breaks down as the data set is expanded to countries with larger potentials (R^2 is 0.1 for countries with at least 300 GW of potential).