Skip to content

Commit af3e28c

Browse files
zkamvarCarpentries Apprentice
authored andcommitted
[custom] fix lesson contents
1 parent ee731d1 commit af3e28c

18 files changed

+555
-66
lines changed

.Rbuildignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
^renv$
2+
^renv\.lock$
13
^\.travis\.yml$
24
^appveyor\.yml$
35
^tic\.R$

episodes/01-raster-structure.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ source: Rmd
66
---
77

88
```{r setup, echo=FALSE}
9-
source("../setup.R")
9+
source("setup.R")
1010
knitr::opts_chunk$set(fig.height = 6)
1111
```
1212

episodes/02-raster-plot.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ source: Rmd
66
---
77

88
```{r setup, echo=FALSE}
9-
source("../setup.R")
9+
source("setup.R")
1010
```
1111

1212
::::::::::::::::::::::::::::::::::::::: objectives

episodes/03-raster-reproject-in-r.Rmd

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ source: Rmd
66
---
77

88
```{r setup, echo=FALSE}
9-
source("../setup.R")
9+
source("setup.R")
1010
```
1111

1212
::::::::::::::::::::::::::::::::::::::: objectives
@@ -296,38 +296,42 @@ field site using the `SJER_DSMhill_WGS84.tif` and `SJER_dsmCrop.tif` files.
296296

297297
Reproject the data as necessary to make things line up!
298298

299-
> ## Answers
300-
>
301-
> ```{r challenge-code-reprojection, echo=TRUE}
302-
> # import DSM
303-
> DSM_SJER <- raster("data/NEON-DS-Airborne-Remote-Sensing/SJER/DSM/SJER_dsmCrop.tif")
304-
> # import DSM hillshade
305-
> DSM_hill_SJER_WGS <-
306-
> raster("data/NEON-DS-Airborne-Remote-Sensing/SJER/DSM/SJER_DSMhill_WGS84.tif")
307-
>
308-
> # reproject raster
309-
> DTM_hill_UTMZ18N_SJER <- projectRaster(DSM_hill_SJER_WGS,
310-
> crs = crs(DSM_SJER),
311-
> res = 1)
312-
>
313-
> # convert to data.frames
314-
> DSM_SJER_df <- as.data.frame(DSM_SJER, xy = TRUE)
315-
>
316-
> DSM_hill_SJER_df <- as.data.frame(DTM_hill_UTMZ18N_SJER, xy = TRUE)
317-
>
318-
> ggplot() +
319-
> geom_raster(data = DSM_hill_SJER_df,
320-
> aes(x = x, y = y,
321-
> alpha = SJER_DSMhill_WGS84)
322-
> ) +
323-
> geom_raster(data = DSM_SJER_df,
324-
> aes(x = x, y = y,
325-
> fill = SJER_dsmCrop,
326-
> alpha=0.8)
327-
> ) +
328-
> scale_fill_gradientn(name = "Elevation", colors = terrain.colors(10)) +
329-
> coord_quickmap()
330-
> ```
299+
::::::::::::::: solution
300+
301+
## Answers
302+
303+
```{r challenge-code-reprojection, echo=TRUE}
304+
# import DSM
305+
DSM_SJER <- raster("data/NEON-DS-Airborne-Remote-Sensing/SJER/DSM/SJER_dsmCrop.tif")
306+
# import DSM hillshade
307+
DSM_hill_SJER_WGS <-
308+
raster("data/NEON-DS-Airborne-Remote-Sensing/SJER/DSM/SJER_DSMhill_WGS84.tif")
309+
310+
# reproject raster
311+
DTM_hill_UTMZ18N_SJER <- projectRaster(DSM_hill_SJER_WGS,
312+
crs = crs(DSM_SJER),
313+
res = 1)
314+
315+
# convert to data.frames
316+
DSM_SJER_df <- as.data.frame(DSM_SJER, xy = TRUE)
317+
318+
DSM_hill_SJER_df <- as.data.frame(DTM_hill_UTMZ18N_SJER, xy = TRUE)
319+
320+
ggplot() +
321+
geom_raster(data = DSM_hill_SJER_df,
322+
aes(x = x, y = y,
323+
alpha = SJER_DSMhill_WGS84)
324+
) +
325+
geom_raster(data = DSM_SJER_df,
326+
aes(x = x, y = y,
327+
fill = SJER_dsmCrop,
328+
alpha=0.8)
329+
) +
330+
scale_fill_gradientn(name = "Elevation", colors = terrain.colors(10)) +
331+
coord_quickmap()
332+
```
333+
334+
:::::::::::::::::::::::::
331335

332336
If you completed the San Joaquin plotting challenge in the
333337
[Plot Raster Data in R](02-raster-plot/)

episodes/04-raster-calculations-in-r.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ source: Rmd
66
---
77

88
```{r setup, echo=FALSE}
9-
source("../setup.R")
9+
source("setup.R")
1010
```
1111

1212
::::::::::::::::::::::::::::::::::::::: objectives

episodes/05-raster-multi-band-in-r.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ source: Rmd
66
---
77

88
```{r setup, echo=FALSE}
9-
source("../setup.R")
9+
source("setup.R")
1010
```
1111

1212
::::::::::::::::::::::::::::::::::::::: objectives

episodes/06-vector-open-shapefile-in-r.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ source: Rmd
66
---
77

88
```{r setup, echo=FALSE}
9-
source("../setup.R")
9+
source("setup.R")
1010
```
1111

1212
::::::::::::::::::::::::::::::::::::::: objectives

episodes/07-vector-shapefile-attributes-in-r.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ source: Rmd
66
---
77

88
```{r setup, echo=FALSE}
9-
source("../setup.R")
9+
source("setup.R")
1010
```
1111

1212
::::::::::::::::::::::::::::::::::::::: objectives

episodes/08-vector-plot-shapefiles-custom-legend.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ source: Rmd
66
---
77

88
```{r setup, echo=FALSE}
9-
source("../setup.R")
9+
source("setup.R")
1010
```
1111

1212
::::::::::::::::::::::::::::::::::::::: objectives

episodes/09-vector-when-data-dont-line-up-crs.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ source: Rmd
66
---
77

88
```{r setup, echo=FALSE}
9-
source("../setup.R")
9+
source("setup.R")
1010
```
1111

1212
::::::::::::::::::::::::::::::::::::::: objectives

0 commit comments

Comments
 (0)