Skip to content

Commit

Permalink
Updates (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
serbinsh authored Jun 17, 2024
1 parent ad61ca0 commit 8454110
Show file tree
Hide file tree
Showing 117 changed files with 531 additions and 6,933 deletions.
Binary file added inst/doc/ely_etal_ex1.pdf
Binary file not shown.
Binary file added inst/doc/ely_etal_ex2.pdf
Binary file not shown.
Binary file added inst/doc/kit_sla_ex3.pdf
Binary file not shown.
Binary file added inst/doc/neon_canopy_leafN_ex5.pdf
Binary file not shown.
Binary file added inst/doc/neon_canopy_lma_ex10.pdf
Binary file not shown.
Binary file added inst/doc/neon_lma_ex4.pdf
Binary file not shown.
Binary file added inst/doc/reseco_leafN_ex6.pdf
Binary file not shown.
Binary file added inst/doc/reseco_leafN_ex7.pdf
Binary file not shown.
Binary file added inst/doc/reseco_lma_ex8.pdf
Binary file not shown.
Binary file added inst/doc/sserbin2019_plsr_ex9.pdf
Binary file not shown.
Binary file removed inst/docs/ely_etal_ex1.pdf
Binary file not shown.
Binary file removed inst/docs/ely_etal_ex2.pdf
Binary file not shown.
Binary file removed inst/docs/kit_sla_ex3.pdf
Binary file not shown.
Binary file removed inst/docs/neon_canopy_leafN_ex5.pdf
Binary file not shown.
Binary file removed inst/docs/neon_lma_ex4.pdf
Binary file not shown.
Binary file removed inst/docs/reseco_leafN_ex6.pdf
Binary file not shown.
Binary file removed inst/docs/reseco_leafN_ex7.pdf
Binary file not shown.
Binary file removed inst/docs/reseco_lma_ex8.pdf
Binary file not shown.
Binary file removed inst/docs/sserbin2019_plsr_ex9.pdf
Binary file not shown.
Binary file renamed spectratrait_1.2.1.pdf → spectratrait_1.2.5.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions vignettes/ely_etal_ex1.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ author: "Shawn P. Serbin, Julien Lamour, & Jeremiah Anderson"
date: "`r Sys.Date()`"
output:
github_document: default
pdf_document: default
html_notebook: default
html_document:
df_print: paged
keep_md: true
pdf_document: default
html_notebook: default
rmarkdown: html_vignette
vignette: >
%\VignetteIndexEntry{Spectra-trait PLSR example using leaf-level spectra and leaf nitrogen content (Narea, g/m2) data from eight different crop species growing in a glasshouse at Brookhaven National Laboratory}
Expand Down
49 changes: 40 additions & 9 deletions vignettes/ely_etal_ex1.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ content (Narea, g/m2) data from eight different crop species growing in
a glasshouse at Brookhaven National Laboratory
================
Shawn P. Serbin, Julien Lamour, & Jeremiah Anderson
2022-03-17
2024-06-17

### Overview

This is an [R Markdown](http://rmarkdown.rstudio.com) Notebook to
illustrate how to load an internal dataset (“ely\_plsr\_data”), choose
the “optimal” number of plsr components, and fit a plsr model for leaf
illustrate how to load an internal dataset (“ely_plsr_data”), choose the
“optimal” number of plsr components, and fit a plsr model for leaf
nitrogen content (Narea, g/m2)

### Getting Started
Expand All @@ -21,14 +21,16 @@ list.of.packages <- c("pls","dplyr","here","plotrix","ggplot2","gridExtra","spec
invisible(lapply(list.of.packages, library, character.only = TRUE))
```

## Warning: package 'pls' was built under R version 4.3.1

##
## Attaching package: 'pls'

## The following object is masked from 'package:stats':
##
## loadings

## Warning: package 'dplyr' was built under R version 4.0.5
## Warning: package 'dplyr' was built under R version 4.3.1

##
## Attaching package: 'dplyr'
Expand All @@ -41,7 +43,11 @@ invisible(lapply(list.of.packages, library, character.only = TRUE))
##
## intersect, setdiff, setequal, union

## here() starts at /Users/sserbin/Data/GitHub/spectratrait
## here() starts at /Users/sserbin/Library/CloudStorage/OneDrive-NASA/Data/Github/spectratrait

## Warning: package 'plotrix' was built under R version 4.3.1

## Warning: package 'ggplot2' was built under R version 4.3.1

##
## Attaching package: 'gridExtra'
Expand Down Expand Up @@ -103,7 +109,7 @@ inVar <- "N_g_m2"

### Set working directory (scratch space)

## [1] "/private/var/folders/xp/h3k9vf3n2jx181ts786_yjrn9c2gjq/T/RtmpP2S4KY"
## [1] "/private/var/folders/th/fpt_z3417gn8xgply92pvy6r0000gq/T/RtmpJ3BBUV"

### Full PLSR dataset

Expand Down Expand Up @@ -219,6 +225,14 @@ cal_hist_plot <- qplot(cal.plsr.data[,paste0(inVar)],geom="histogram",
main = paste0("Cal. Histogram for ",inVar),
xlab = paste0(inVar),ylab = "Count",fill=I("grey50"),col=I("black"),
alpha=I(.7))
```

## Warning: `qplot()` was deprecated in ggplot2 3.4.0.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

``` r
val_hist_plot <- qplot(val.plsr.data[,paste0(inVar)],geom="histogram",
main = paste0("Val. Histogram for ",inVar),
xlab = paste0(inVar),ylab = "Count",fill=I("grey50"),col=I("black"),
Expand Down Expand Up @@ -495,7 +509,21 @@ cal_scatter_plot <- ggplot(cal.plsr.output, aes(x=PLSR_CV_Predicted, y=get(inVar
axis.title=element_text(size=20, face="bold"),
axis.text.x = element_text(angle = 0,vjust = 0.5),
panel.border = element_rect(linetype = "solid", fill = NA, size=1.5))
```

## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

## Warning: The `size` argument of `element_rect()` is deprecated as of ggplot2 3.4.0.
## ℹ Please use the `linewidth` argument instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

``` r
cal_resid_histogram <- ggplot(cal.plsr.output, aes(x=PLSR_CV_Residuals)) +
geom_histogram(alpha=.5, position="identity") +
geom_vline(xintercept = 0, color="black",
Expand Down Expand Up @@ -534,8 +562,11 @@ scatterplots <- grid.arrange(cal_scatter_plot, val_scatter_plot, cal_resid_histo
val_resid_histogram, nrow=2,ncol=2)
```

## Warning: Removed 3 rows containing missing values (geom_point).
## Removed 3 rows containing missing values (geom_point).
## Warning: Removed 3 rows containing missing values or values outside the scale range
## (`geom_point()`).

## Warning: Removed 3 rows containing missing values or values outside the scale range
## (`geom_point()`).

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Expand Down Expand Up @@ -754,7 +785,7 @@ write.csv(out.jk.coefs,file=file.path(outdir,paste0(inVar,
print(paste("Output directory: ", outdir))
```

## [1] "Output directory: /var/folders/xp/h3k9vf3n2jx181ts786_yjrn9c2gjq/T//RtmpP2S4KY"
## [1] "Output directory: /var/folders/th/fpt_z3417gn8xgply92pvy6r0000gq/T//RtmpJ3BBUV"

``` r
# Observed versus predicted
Expand Down
Binary file modified vignettes/ely_etal_ex1.pdf
Binary file not shown.
Binary file modified vignettes/ely_etal_ex1_files/figure-gfm/unnamed-chunk-10-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 vignettes/ely_etal_ex1_files/figure-gfm/unnamed-chunk-11-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 vignettes/ely_etal_ex1_files/figure-gfm/unnamed-chunk-12-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 vignettes/ely_etal_ex1_files/figure-gfm/unnamed-chunk-14-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 vignettes/ely_etal_ex1_files/figure-gfm/unnamed-chunk-15-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 vignettes/ely_etal_ex1_files/figure-gfm/unnamed-chunk-6-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 vignettes/ely_etal_ex1_files/figure-gfm/unnamed-chunk-8-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 vignettes/ely_etal_ex1_files/figure-gfm/unnamed-chunk-9-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions vignettes/ely_etal_ex2.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ title: Spectra-trait PLSR example using leaf-level spectra and leaf nitrogen con
author: "Shawn P. Serbin, Julien Lamour, & Jeremiah Anderson"
date: "`r Sys.Date()`"
output:
github_document: default
html_notebook: default
pdf_document: default
html_notebook: default
github_document: default
html_document:
df_print: paged
keep_md: true
Expand Down
48 changes: 39 additions & 9 deletions vignettes/ely_etal_ex2.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ a glasshouse at Brookhaven National Laboratory. This example illustrates
running the PLSR permutation by group
================
Shawn P. Serbin, Julien Lamour, & Jeremiah Anderson
2022-03-17
2024-06-17

### Overview

This is an [R Markdown](http://rmarkdown.rstudio.com) Notebook to
illustrate how to load an internal dataset (“ely\_plsr\_data”), choose
the “optimal” number of plsr components, and fit a plsr model for leaf
illustrate how to load an internal dataset (“ely_plsr_data”), choose the
“optimal” number of plsr components, and fit a plsr model for leaf
nitrogen content (Narea, g/m2)

### Getting Started
Expand All @@ -22,14 +22,16 @@ list.of.packages <- c("pls","dplyr","here","plotrix","ggplot2","gridExtra","spec
invisible(lapply(list.of.packages, library, character.only = TRUE))
```

## Warning: package 'pls' was built under R version 4.3.1

##
## Attaching package: 'pls'

## The following object is masked from 'package:stats':
##
## loadings

## Warning: package 'dplyr' was built under R version 4.0.5
## Warning: package 'dplyr' was built under R version 4.3.1

##
## Attaching package: 'dplyr'
Expand All @@ -42,7 +44,11 @@ invisible(lapply(list.of.packages, library, character.only = TRUE))
##
## intersect, setdiff, setequal, union

## here() starts at /Users/sserbin/Data/GitHub/spectratrait
## here() starts at /Users/sserbin/Library/CloudStorage/OneDrive-NASA/Data/Github/spectratrait

## Warning: package 'plotrix' was built under R version 4.3.1

## Warning: package 'ggplot2' was built under R version 4.3.1

##
## Attaching package: 'gridExtra'
Expand Down Expand Up @@ -104,7 +110,7 @@ inVar <- "N_g_m2"

### Set working directory (scratch space)

## [1] "/private/var/folders/xp/h3k9vf3n2jx181ts786_yjrn9c2gjq/T/RtmpX6UzBl"
## [1] "/private/var/folders/th/fpt_z3417gn8xgply92pvy6r0000gq/T/RtmpXZoXO6"

### Full PLSR dataset

Expand Down Expand Up @@ -220,6 +226,14 @@ cal_hist_plot <- qplot(cal.plsr.data[,paste0(inVar)],geom="histogram",
main = paste0("Cal. Histogram for ",inVar),
xlab = paste0(inVar),ylab = "Count",fill=I("grey50"),col=I("black"),
alpha=I(.7))
```

## Warning: `qplot()` was deprecated in ggplot2 3.4.0.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

``` r
val_hist_plot <- qplot(val.plsr.data[,paste0(inVar)],geom="histogram",
main = paste0("Val. Histogram for ",inVar),
xlab = paste0(inVar),ylab = "Count",fill=I("grey50"),col=I("black"),
Expand Down Expand Up @@ -493,7 +507,21 @@ cal_scatter_plot <- ggplot(cal.plsr.output, aes(x=PLSR_CV_Predicted, y=get(inVar
axis.title=element_text(size=20, face="bold"),
axis.text.x = element_text(angle = 0,vjust = 0.5),
panel.border = element_rect(linetype = "solid", fill = NA, size=1.5))
```

## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

## Warning: The `size` argument of `element_rect()` is deprecated as of ggplot2 3.4.0.
## ℹ Please use the `linewidth` argument instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

``` r
cal_resid_histogram <- ggplot(cal.plsr.output, aes(x=PLSR_CV_Residuals)) +
geom_histogram(alpha=.5, position="identity") +
geom_vline(xintercept = 0, color="black",
Expand Down Expand Up @@ -532,9 +560,11 @@ scatterplots <- grid.arrange(cal_scatter_plot, val_scatter_plot, cal_resid_histo
val_resid_histogram, nrow=2,ncol=2)
```

## Warning: Removed 5 rows containing missing values (geom_point).
## Warning: Removed 5 rows containing missing values or values outside the scale range
## (`geom_point()`).

## Warning: Removed 4 rows containing missing values (geom_point).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_point()`).

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Expand Down Expand Up @@ -755,7 +785,7 @@ write.csv(out.jk.coefs,file=file.path(outdir,paste0(inVar,
print(paste("Output directory: ", outdir))
```

## [1] "Output directory: /var/folders/xp/h3k9vf3n2jx181ts786_yjrn9c2gjq/T//RtmpX6UzBl"
## [1] "Output directory: /var/folders/th/fpt_z3417gn8xgply92pvy6r0000gq/T//RtmpXZoXO6"

``` r
# Observed versus predicted
Expand Down
Binary file modified vignettes/ely_etal_ex2.pdf
Binary file not shown.
Binary file modified vignettes/ely_etal_ex2_files/figure-gfm/unnamed-chunk-10-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 vignettes/ely_etal_ex2_files/figure-gfm/unnamed-chunk-11-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 vignettes/ely_etal_ex2_files/figure-gfm/unnamed-chunk-12-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 vignettes/ely_etal_ex2_files/figure-gfm/unnamed-chunk-14-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 vignettes/ely_etal_ex2_files/figure-gfm/unnamed-chunk-15-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 vignettes/ely_etal_ex2_files/figure-gfm/unnamed-chunk-6-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 vignettes/ely_etal_ex2_files/figure-gfm/unnamed-chunk-8-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 vignettes/ely_etal_ex2_files/figure-gfm/unnamed-chunk-9-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions vignettes/kit_sla_ex3.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ title: Spectra-trait PLSR example using leaf-level spectra and specific leaf are
author: "Shawn P. Serbin, Julien Lamour, & Jeremiah Anderson"
date: "`r Sys.Date()`"
output:
github_document: default
pdf_document: default
github_document: default
html_notebook: default
html_document:
df_print: paged
Expand Down Expand Up @@ -145,12 +145,10 @@ write.csv(val.plsr.data,file=file.path(outdir,paste0(inVar,'_Val_PLSR_Dataset.cs
cal_spec <- as.matrix(cal.plsr.data[, which(names(cal.plsr.data) %in% paste0("Wave_",wv))])
cal.plsr.data <- data.frame(cal.plsr.data[, which(names(cal.plsr.data) %notin% paste0("Wave_",wv))],
Spectra=I(cal_spec))
head(cal.plsr.data)[1:5]
val_spec <- as.matrix(val.plsr.data[, which(names(val.plsr.data) %in% paste0("Wave_",wv))])
val.plsr.data <- data.frame(val.plsr.data[, which(names(val.plsr.data) %notin% paste0("Wave_",wv))],
Spectra=I(val_spec))
head(val.plsr.data)[1:5]
```

### plot cal and val spectra
Expand Down
Loading

0 comments on commit 8454110

Please sign in to comment.