-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f2c7d4f
commit d0eabc2
Showing
90 changed files
with
14,591 additions
and
1,106 deletions.
There are no files selected for viewing
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 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 file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generate a dataset | ||
# make a scatterplot | ||
# summarize a linear model | ||
|
||
# Short script to illustrate copilot in coding | ||
library(tidyverse) | ||
|
||
data=tibble( | ||
x=rnorm(10), | ||
y=3*x+15+rnorm(10)) | ||
|
||
|
||
ggplot(data,aes(x=x,y=y))+ | ||
geom_point()+ | ||
geom_smooth(method="lm") | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
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 file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Create a robust function to calculate the standard error of a vector | ||
# The function name will be calc_se with an argument x for the vector, with | ||
# an argument to remove missing values called na.rm, and a default value of TRUE | ||
# The function should have type checking to only allow numeric vectors | ||
|
||
# ```{r} | ||
# calc_se=function(x,na.rm=T){ | ||
# if(!is.numeric(x)){ | ||
# stop("Input must be a numeric vector") | ||
# } | ||
|
||
# if(na.rm){ | ||
# x=na.omit(x) | ||
# } | ||
# sqrt(var(x)/length(x)) | ||
# } | ||
|
||
|
||
# # Test the function | ||
x=c(3,6,12,89) | ||
calc_se(x) | ||
|
||
|
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 file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
|
||
library(dplyr) | ||
|
||
mtcars | ||
|
||
mtcars |> | ||
group_by(cyl) |> | ||
summarize( | ||
mean = mean(mpg), | ||
# add the standard error for mpg | ||
se = sd(mpg) / sqrt(n()) | ||
|
||
) |
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 file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Downloads total population data for buffalo, ny using the tidycensus package | ||
# save the downloaded data as a csv file | ||
# use ggplot to plot the population data | ||
|
||
|
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 file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
|
||
|
||
library(terra) | ||
library(spData) | ||
library(tidyverse) | ||
library(sf) | ||
|
||
|
||
# download.file("https://crudata.uea.ac.uk/cru/data/temperature/absolute.nc","crudata.nc") | ||
|
||
# read in the data using the rast() function from the terra package | ||
tmean=rast("crudata.nc") | ||
data(world) | ||
|
||
max_temp <- tmean %>% | ||
max() %>% | ||
terra::extract(y=world, fun=max, na.rm=T, small=T) | ||
|
||
world_clim=bind_cols(world,max_temp) | ||
|
||
ggplot(world_clim,aes(fill=max))+ | ||
geom_sf()+ | ||
coord_sf(label_graticule="SW",label_axes="SW")+ | ||
scale_fill_viridis_c(name="Maximum\nTemperature (C)")+ | ||
theme(legend.position = 'bottom') | ||
|
||
|
||
world_clim%>% | ||
group_by(continent)%>% | ||
slice_max(n=1,order_by=max) %>% | ||
dplyr::select(name_long,continent,mux=max)%>% | ||
arrange(desc(min))%>% | ||
st_set_geometry(NULL) | ||
|
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
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file added
BIN
+33 KB
...late/CS_08_template.markdown_strict_files/figure-markdown_strict/pressure-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-564 Bytes
(98%)
CS_08_Template/CS_08_template_files/figure-docx/pressure-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+949 Bytes
(100%)
CS_08_Template/CS_08_template_files/figure-html/pressure-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+14.7 KB
(160%)
CS_08_Template/CS_08_template_files/figure-pptx/pressure-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.