diff --git a/DESCRIPTION b/DESCRIPTION index ba7b0c5..968f149 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -17,7 +17,7 @@ License: MIT + file LICENSE Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 Imports: clipr, DBI, diff --git a/R/plot.diagram.R b/R/plot.diagram.R index d6b5366..29908d9 100644 --- a/R/plot.diagram.R +++ b/R/plot.diagram.R @@ -87,7 +87,11 @@ plot_diagram <- function(x, bars=FALSE, if (length(col) != ncol(x)-1) col = base::rep_len(col,ncol(x)-1) - cs <- apply(abs(x[, -1]), 2, max) + if(ncol(x) > 2) { + cs <- apply(abs(x[, -1]), 2, max) + } else { + cs <- max(abs(x[, 2])) + } cs <- ifelse(cs > yax_incr, cs, yax_incr) cs <- c(0, 0, cumsum(cs + sum(cs)*0.01 ) )# Adding 1% of the total space to each row diff --git a/R/plot.loo.R b/R/plot.loo.R index 495bf01..94fb589 100644 --- a/R/plot.loo.R +++ b/R/plot.loo.R @@ -149,17 +149,21 @@ plot_loo <- function( x, optima=TRUE, df <- df[, c(1, order(apply(df[, -1], 2, function(x) mean(x[abs(x)>0])), decreasing = ifelse(sort=='incr', FALSE, TRUE)) + 1)] } - df <- df[, c(1, which(apply(df[, -1], 2, function(x) mean(abs(x)[abs(x)>0])) >= filter) + 1)] - - plot_diagram(df, bars=TRUE, - save=save, filename=paste0(strsplit(filename, ifelse(as.png, '.png', '.pdf'))[[1]],'_',clim,ifelse(as.png, '.png', '.pdf')), - width=width, height=height, as.png=as.png, png.res=png.res, - yax_incr=yax_incr2, bar_width=bar_width2, xlim=xlim, - tickAtSample=tickAtSample, - col_pos=col_pos[clim], col_neg=col_neg[clim], - title=title2, src='loo') - - rs[[clim]] <- sort(unlist(lapply(x$reconstructions[[clim]]$loo, function(x) return(mean(x[abs(x)>0]))))) + w <- which(apply(df[, -1], 2, function(x) mean(abs(x)[abs(x)>0])) >= filter) + if(length(w) == 0) { + warning("No taxa remain after filtering. Adjust the filter value to include more taxa.") + } else { + df <- df[, c(1, w + 1)] + plot_diagram(df, bars=TRUE, + save=save, filename=paste0(strsplit(filename, ifelse(as.png, '.png', '.pdf'))[[1]],'_',clim,ifelse(as.png, '.png', '.pdf')), + width=width, height=height, as.png=as.png, png.res=png.res, + yax_incr=yax_incr2, bar_width=bar_width2, xlim=xlim, + tickAtSample=tickAtSample, + col_pos=col_pos[clim], col_neg=col_neg[clim], + title=title2, src='loo') + + rs[[clim]] <- sort(unlist(lapply(x$reconstructions[[clim]]$loo, function(y) if(!unique(as.vector(is.na(y)))){return(mean(y[, var_to_plot][abs(y[, var_to_plot])>0]))}))) + } } return(invisible(rs)) diff --git a/crestr_1.3.1.9000.pdf b/crestr_1.3.1.9000.pdf index 5bbe7ce..479fdee 100644 Binary files a/crestr_1.3.1.9000.pdf and b/crestr_1.3.1.9000.pdf differ diff --git a/docs/404.html b/docs/404.html index c67dc0d..14bef9f 100644 --- a/docs/404.html +++ b/docs/404.html @@ -6,7 +6,7 @@
vignettes/calibration-data.Rmd
calibration-data.Rmd
vignettes/community.Rmd
community.Rmd
Site built with pkgdown 2.0.7.
+Site built with pkgdown 2.0.9.
diff --git a/docs/articles/databasing-with-crestr.html b/docs/articles/databasing-with-crestr.html index b55c3e8..d18557b 100644 --- a/docs/articles/databasing-with-crestr.html +++ b/docs/articles/databasing-with-crestr.html @@ -6,7 +6,7 @@vignettes/databasing-with-crestr.Rmd
databasing-with-crestr.Rmd
vignettes/get-started.Rmd
get-started.Rmd
crestr
#> Sample_3 3 0 0 49 0 25 26 0
#> Sample_4 4 0 0 37 0 27 36 0
#> Sample_5 5 0 3 36 3 18 40 0
-#> Sample_6 6 2 2 25 0 21 50 0
-
+#> Sample_6 6 2 2 25 0 21 50 0
+
+
## the structure of the data frame
str(crest_ex)
#> 'data.frame': 20 obs. of 8 variables:
@@ -271,7 +272,7 @@ The pseudo-data within crestr
pollen-type. Here, the seven pseudo-taxa are
‘identified’ at the species level so that the table looks like the
following:
-
+
crest_ex_pse
#> Level Family Genus Species ProxyName
#> 1 3 Randomaceae Randomus Taxon1 Taxon1
@@ -293,7 +294,7 @@ The pseudo-data within crestr
-
+
crest_ex_selection
#> bio1 bio12
#> Taxon1 1 1
@@ -328,7 +329,7 @@ Data extraction and calibrationcrestObj vignette. We can also verify that the
selectedTaxa table has been modified for Taxon7.
-
+
reconstr <- crest.get_modern_data(
df = crest_ex, # The fossil data
pse = crest_ex_pse, # The proxy-species equivalency table
@@ -340,7 +341,7 @@ Data extraction and calibration dbname = "crest_example", # The database to extract the data
verbose = FALSE # Print status messages
)
-
+
reconstr$inputs$selectedTaxa
#> bio1 bio12
#> Taxon1 1 1
@@ -355,7 +356,7 @@ Data extraction and calibration
-
+
print(reconstr, as='data_extracted')
#> *
#> * Summary of the crestObj named ``:
@@ -386,7 +387,7 @@ Data extraction and calibration
-
+
reconstr <- crest.calibrate(
reconstr, # A crestObj produced at the last stage
climateSpaceWeighting = TRUE, # Correct the PDFs for the heteregenous
@@ -395,7 +396,7 @@ Data extraction and calibration shape = c("normal", "lognormal"), # The shape of the species PDFs
verbose = FALSE # Print status messages
)
-
+
plot_climateSpace(reconstr)
Data extraction and calibration
-
+
plot_taxaCharacteristics(reconstr, taxanames='Taxon2', climate='bio1', h0=0.2)
plot_taxaCharacteristics(reconstr, taxanames='Taxon6', climate='bio1', h0=0.2)
@@ -443,16 +444,17 @@ Reconstruction and interpretationcrest.reconstruct() function. The results can be
accessed from reconstr
as follow:
-
+
reconstr <- crest.reconstruct(
reconstr, # A crestObj produced at the previous stage
verbose = FALSE # Print status messages
)
-
+
names(reconstr)
#> [1] "inputs" "parameters" "modelling" "reconstructions"
-#> [5] "misc"
-
+#> [5] "misc"
+
+
head(reconstr$reconstructions$bio1$optima)
#> Age optima mean
#> 1 1 15.71142 15.69949
@@ -460,14 +462,16 @@ Reconstruction and interpretation#> 3 3 15.71142 15.69949
#> 4 4 15.71142 15.69949
#> 5 5 17.31463 17.29054
-#> 6 6 18.11623 18.12464
-
+#> 6 6 18.11623 18.12464
+
+
str(reconstr$reconstructions$bio1$optima)
#> 'data.frame': 20 obs. of 3 variables:
#> $ Age : num 1 2 3 4 5 6 7 8 9 10 ...
#> $ optima: num 15.7 15.7 15.7 15.7 17.3 ...
-#> $ mean : num 15.7 15.7 15.7 15.7 17.3 ...
-
+#> $ mean : num 15.7 15.7 15.7 15.7 17.3 ...
+
+
signif(reconstr$reconstructions$bio1$likelihood[1:6, 1:6], 3)
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,] 0.00e+00 8.02e-02 1.60e-01 2.40e-01 3.21e-01 4.01e-01
@@ -475,11 +479,13 @@ Reconstruction and interpretation#> [3,] 8.41e-15 1.15e-14 1.57e-14 2.14e-14 2.92e-14 3.97e-14
#> [4,] 8.41e-15 1.15e-14 1.57e-14 2.14e-14 2.92e-14 3.97e-14
#> [5,] 8.41e-15 1.15e-14 1.57e-14 2.14e-14 2.92e-14 3.97e-14
-#> [6,] 1.45e-18 2.09e-18 3.01e-18 4.32e-18 6.19e-18 8.86e-18
-
+#> [6,] 1.45e-18 2.09e-18 3.01e-18 4.32e-18 6.19e-18 8.86e-18
+
+
str(reconstr$reconstructions$bio1$likelihood)
-#> num [1:21, 1:500] 0.00 8.41e-15 8.41e-15 8.41e-15 8.41e-15 ...
-
+#> num [1:21, 1:500] 0.00 8.41e-15 8.41e-15 8.41e-15 8.41e-15 ...
+
+
print(reconstr, as='climate_reconstructed')
#> *
#> * Summary of the crestObj named ``:
@@ -525,7 +531,7 @@ Reconstruction and interpretation
-
+
plot(reconstr, climate = 'bio1')
plot(reconstr, climate = 'bio12', simplify=TRUE,
uncertainties=c(0.4, 0.6, 0.8), as.anomaly=TRUE)
@@ -548,9 +554,9 @@ Reconstruction and interpretation
-
+
reconstr <- loo(reconstr)
-
+
plot_loo(reconstr, climate = 'bio1')
Exporting the results
-
+
export(reconstr, loc=tempdir(), dataname='crest-test')
list.files(file.path(tempdir(), 'crest-test'))
#> [1] "bio1" "bio12" "crest-test.RData"
@@ -619,7 +625,7 @@ References
diff --git a/docs/articles/get-started_files/figure-html/plot-1.png b/docs/articles/get-started_files/figure-html/plot-1.png
index 7db5e4f..187fa9d 100644
Binary files a/docs/articles/get-started_files/figure-html/plot-1.png and b/docs/articles/get-started_files/figure-html/plot-1.png differ
diff --git a/docs/articles/get-started_files/figure-html/plot-2.png b/docs/articles/get-started_files/figure-html/plot-2.png
index 98e372d..17e624d 100644
Binary files a/docs/articles/get-started_files/figure-html/plot-2.png and b/docs/articles/get-started_files/figure-html/plot-2.png differ
diff --git a/docs/articles/index.html b/docs/articles/index.html
index eadaa7b..7f6863e 100644
--- a/docs/articles/index.html
+++ b/docs/articles/index.html
@@ -1,5 +1,5 @@
-Articles • crestr Articles • crestr
@@ -113,7 +113,7 @@ All vignettes
diff --git a/docs/articles/limpopo.html b/docs/articles/limpopo.html
index d400670..81c74ec 100644
--- a/docs/articles/limpopo.html
+++ b/docs/articles/limpopo.html
@@ -6,7 +6,7 @@
Mean Annual Temperature reconstruction from marine core MD96-2048 • crestr
-
+
@@ -110,7 +110,7 @@ Mean Annual Temperature reconstruction from
Manuel
Chevalier
- 2024-03-21
+ 2024-06-10
Source: vignettes/limpopo.Rmd
limpopo.Rmd
@@ -142,7 +142,7 @@ 2024-03-21
diff --git a/docs/articles/technicalities.html b/docs/articles/technicalities.html
index 1ec7e3d..c5546e4 100644
--- a/docs/articles/technicalities.html
+++ b/docs/articles/technicalities.html
@@ -6,7 +6,7 @@
Formatting the data for crestr • crestr
-
+
@@ -109,7 +109,7 @@ Formatting the data for crestr
Manuel
Chevalier
- 2024-03-21
+ 2024-06-10
Source: vignettes/technicalities.Rmd
technicalities.Rmd
@@ -492,7 +492,7 @@ The selectedTaxa
data frame
-Site built with pkgdown 2.0.7.
+Site built with pkgdown 2.0.9.
diff --git a/docs/articles/theory.html b/docs/articles/theory.html
index 1b21092..8e072df 100644
--- a/docs/articles/theory.html
+++ b/docs/articles/theory.html
@@ -6,7 +6,7 @@
A bit of Theory • crestr
-
+
@@ -109,7 +109,7 @@ A bit of Theory
Manuel
Chevalier
- 2024-03-21
+ 2024-06-10
Source: vignettes/theory.Rmd
theory.Rmd
@@ -296,7 +296,7 @@ References
diff --git a/docs/articles/warnings.html b/docs/articles/warnings.html
index 36e01c9..e71708d 100644
--- a/docs/articles/warnings.html
+++ b/docs/articles/warnings.html
@@ -6,7 +6,7 @@
Understanding warnings in crestr • crestr
-
+
@@ -109,7 +109,7 @@ Understanding warnings in crestr
Manuel
Chevalier
- 2024-03-21
+ 2024-06-10
Source: vignettes/warnings.Rmd
warnings.Rmd
@@ -268,7 +268,7 @@
-Site built with pkgdown 2.0.7.
+Site built with pkgdown 2.0.9.
diff --git a/docs/authors.html b/docs/authors.html
index 901847d..8407a6c 100644
--- a/docs/authors.html
+++ b/docs/authors.html
@@ -1,5 +1,5 @@
-Authors and Citation • crestr Authors and Citation • crestr
@@ -81,7 +81,7 @@
diff --git a/docs/index.html b/docs/index.html
index f28e6fe..e328503 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -6,18 +6,13 @@
A Probabilistic Approach to Reconstruct Past Climates Using Palaeoecological Datasets • crestr
-
+
-
+
Changelog • crestr Changelog • crestr
@@ -233,7 +233,7 @@ crestr 0.
diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml
index 9002b62..f77a6f2 100644
--- a/docs/pkgdown.yml
+++ b/docs/pkgdown.yml
@@ -1,5 +1,5 @@
pandoc: 3.1.11.1
-pkgdown: 2.0.7
+pkgdown: 2.0.9
pkgdown_sha: ~
articles:
calibration-data: calibration-data.html
@@ -10,5 +10,5 @@ articles:
technicalities: technicalities.html
theory: theory.html
warnings: warnings.html
-last_built: 2024-03-21T16:46Z
+last_built: 2024-06-10T09:40Z
diff --git a/docs/reference/M1.html b/docs/reference/M1.html
index 696ccf7..85a740a 100644
--- a/docs/reference/M1.html
+++ b/docs/reference/M1.html
@@ -1,7 +1,5 @@
-A shapefile of the world's country borders. Use 'M1 <- terra::unwrap(M1)' to
-render the object usable in R. — M1 • crestr A shapefile of the world's country borders. Use 'M1 <- terra::unwrap(M1)' to render the object usable in R. — M1 • crestr Displays the log of the proxy-species association — PSE_log • crestr Displays the log of the proxy-species association — PSE_log • crestr Return the list of oceans and seas. — accBasinNames • crestr Return the list of oceans and seas. — accBasinNames • crestr
@@ -232,7 +232,7 @@ Examples
diff --git a/docs/reference/accClimateVariables.html b/docs/reference/accClimateVariables.html
index 56bff60..935d391 100644
--- a/docs/reference/accClimateVariables.html
+++ b/docs/reference/accClimateVariables.html
@@ -1,5 +1,5 @@
-Describes all the variables available in the database. — accClimateVariables • crestr Describes all the variables available in the database. — accClimateVariables • crestr Return the list of the continents and associated countries. — accCountryNames • crestr Return the list of the continents and associated countries. — accCountryNames • crestr
@@ -321,7 +321,7 @@ Examples
diff --git a/docs/reference/accRealmNames.html b/docs/reference/accRealmNames.html
index f4d55ea..bb0b697 100644
--- a/docs/reference/accRealmNames.html
+++ b/docs/reference/accRealmNames.html
@@ -1,5 +1,5 @@
-Return the list of the realms and associated biomes and ecoregions. — accRealmNames • crestr Return the list of the realms and associated biomes and ecoregions. — accRealmNames • crestr
@@ -2180,7 +2180,7 @@ Examples
diff --git a/docs/reference/calib_clim_space.html b/docs/reference/calib_clim_space.html
index 2a6c18c..8dc7c7f 100644
--- a/docs/reference/calib_clim_space.html
+++ b/docs/reference/calib_clim_space.html
@@ -1,5 +1,5 @@
-Calibrate the distribution of the modern climate space. — calib_clim_space • crestr Calibrate the distribution of the modern climate space. — calib_clim_space • crestr
@@ -136,7 +136,7 @@ Examples
diff --git a/docs/reference/check_coordinates.html b/docs/reference/check_coordinates.html
index 88a36a0..3531d7d 100644
--- a/docs/reference/check_coordinates.html
+++ b/docs/reference/check_coordinates.html
@@ -1,5 +1,5 @@
-Check if the coordinates are correct. — check_coordinates • crestr Check if the coordinates are correct. — check_coordinates • crestr
@@ -132,7 +132,7 @@ Examples
diff --git a/docs/reference/cite_climate_data.html b/docs/reference/cite_climate_data.html
index e26e08a..ded7ef4 100644
--- a/docs/reference/cite_climate_data.html
+++ b/docs/reference/cite_climate_data.html
@@ -1,5 +1,5 @@
-Returns the references associated with the climate data used to fit the pdfs. — cite_climate_data • crestr Returns the references associated with the climate data used to fit the pdfs. — cite_climate_data • crestr
@@ -125,7 +125,7 @@ Value
diff --git a/docs/reference/cite_crest.html b/docs/reference/cite_crest.html
index 693786b..52465cc 100644
--- a/docs/reference/cite_crest.html
+++ b/docs/reference/cite_crest.html
@@ -1,5 +1,5 @@
-Returns the list of references associated to the reconstruction. — cite_crest • crestr Returns the list of references associated to the reconstruction. — cite_crest • crestr
@@ -125,7 +125,7 @@ Value
diff --git a/docs/reference/cite_distrib_data.html b/docs/reference/cite_distrib_data.html
index ceec6f5..67c5099 100644
--- a/docs/reference/cite_distrib_data.html
+++ b/docs/reference/cite_distrib_data.html
@@ -1,5 +1,5 @@
-Returns the references associated with the GBIF data used to fit the pdfs. — cite_distrib_data • crestr Returns the references associated with the GBIF data used to fit the pdfs. — cite_distrib_data • crestr
@@ -125,7 +125,7 @@ Value
diff --git a/docs/reference/cite_method.html b/docs/reference/cite_method.html
index 02348d4..937770f 100644
--- a/docs/reference/cite_method.html
+++ b/docs/reference/cite_method.html
@@ -1,5 +1,5 @@
-Returns the references associated with the development of CREST. — cite_method • crestr Returns the references associated with the development of CREST. — cite_method • crestr
@@ -125,7 +125,7 @@ Value
A shapefile of the world's country borders. Use 'M1 <- terra::unwrap(M1)' to -render the object usable in R.
A shapefile of the world's country borders. Use 'M1 <- terra::unwrap(M1)' to render the object usable in R.