diff --git a/week_06/CS_06_nocomments.R b/week_06/CS_06_nocomments.R new file mode 100644 index 0000000..4d4abe3 --- /dev/null +++ b/week_06/CS_06_nocomments.R @@ -0,0 +1,23 @@ +install.packages("ncdf4") + +library(terra) +library(spData) +library(tidyverse) +library(sf) + +library(ncdf4) +download.file("https://crudata.uea.ac.uk/cru/data/temperature/absolute.nc","crudata.nc", method="curl") + +# read in the data using the rast() function from the terra package +tmean=rast("crudata.nc") +plot(tmean) +plot(max(tmean)) + +data(world) +max_temp_by_country <- terra::extract(tmean, world, fun = max, na.rm=T, small=T) +head(max_temp_by_country) + +world_clim <- bind_cols(world, as_tibble(max_temp_by_country)[, -1]) + +# Display the new combined data +head(world_clim) \ No newline at end of file diff --git a/week_06/world_clim.png b/week_06/world_clim.png new file mode 100644 index 0000000..db179f9 Binary files /dev/null and b/week_06/world_clim.png differ