knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
Since the dependent package
spectral.methods is not available from CRAN now, and also has problems with the code from Github, the SSA method is not supported in this package anymore.
This is a package including four gap-filling methods for soil respiration data investigated in the study of Zhao et al. (2020, see the citation at the end). The four methods are referred to as non-linear least squares (NLS), artificial neural networks (ANN), singular spectrum analysis (SSA) and expectation-maximization (EM).
First, make sure the package
remotes is installed in R. If not,
install the package by:
Then, install the
FluxGapsR package in R by:
The functioning of the package is based on other R packages:
neuralnet and they
must be installed before using the functions in the
Note: in case the installation fails in Rstudio, try to install the package in the original R program and then load the package in Rstudio.
library(FluxGapsR) # load a fraction of example data for visualizing purpose df <- read.csv(file = system.file("extdata", "Soil_resp_example.csv", package = "FluxGapsR"), header = T)[4000:8000,] # load the example reference df_ref <- read.csv(file = system.file("extdata", "Soil_resp_ref_example.csv", package = "FluxGapsR"), header = T)[4000:8000,] # use NLS df_nls <- Gapfill_nls(data = df) # use ANN df_ann <- Gapfill_ann(data = df,var1 = "Ts",var2 = "Ta",var3 = "Moist") # use SSA # df_ssa <- Gapfill_ssa(data = df) # use EM df_em <- Gapfill_em(data = df,ref1 = df_ref) # plot the results plot(df_nls$filled,col="red",type = "l", ylab=expression("Soil respiration rate ("*mu*"mol CO"*" m"^-2*" s"^-1*")")) lines(df_ann$filled,col="blue",lty="dashed") # lines(df_ssa$filled,col="green",lty="dotted") lines(df_em$filled,col="grey") lines(df_nls$Flux) legend(3000,7, legend=c("NLS","ANN","SSA","EM"), col=c("red","blue","green","grey"), lty=c("solid","dashed","dotted","solid"), box.lty=0)
Please cite the package as:
Junbin Zhao, Holger Lange and Helge Meissner. Gap-filling continuously-measured soil respiration data: a highlight of the time-series-based methods. Agricultural and Forest Meteorology, 2020, doi: 10.1016/j.agrformet.2020.107912
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.