Create a snapshot of the data linked to entities. Including metadata, climate & vegetation reconstructions and pollen counts.

snapshot(x, ...)

# S3 method for MariaDBConnection
snapshot(x, ..., ID_ENTITY, ID_SITE, entity_name, site_name, quiet = TRUE)

# S3 method for character
snapshot(x, ..., use_site_name = FALSE)

# S3 method for numeric
snapshot(x, ..., use_id_site = FALSE)

# S3 method for tbl_df
snapshot(x, ...)

# S3 method for tbl
snapshot(x, ...)

# S3 method for data.frame
snapshot(x, ...)

# S3 method for default
snapshot(x, ...)

Arguments

x

This object accepts different classes. If the given object is a database connection, then extracts data from the database using the ID_SITE, ID_ENTITY or entity_name (these should be provided after the connection object). Alternatively, if the given object is a vector, then it will retrieve the records from an internal snapshot of the database, included in this package.

...

Optional parameters.

ID_ENTITY

Optional, if ID_SITE, entity_name or site_name are provided.

ID_SITE

Optional, if ID_ENTITY, entity_name or site_name are provided.

entity_name

Optional, if ID_SITE, ID_ENTITY or site_name are provided.

site_name

Optional, if ID_SITE, ID_ENTITY or entity_name are provided.

quiet

Boolean flag to indicate if queries should be displayed.

use_site_name

Boolean flag to indicate whether to search using entity_name (default) or site_name, using the values in x.

use_id_site

Boolean flag to indicate whether to search using ID_ENTITY (default) or ID_SITE, using the values in x.

Value

List with the individual tables.

Examples


if (FALSE) {
conn <- dabr::open_conn_mysql(dbname = "SMPDSv2",
                              password = rstudioapi::askForPassword())
# Using the entity name
snp1 <- smpds::snapshot(conn, entity_name = "juodonys_core")
snp1

# Using the site name
snp2 <- smpds::snapshot(conn, site_name = "Petresiunai")
snp2

# Using the ID_ENTITY
snp3 <- smpds::snapshot(conn, ID_ENTITY = 1)
snp3

# Using the ID_SITE
snp4 <- smpds::snapshot(conn, ID_SITE = 2)
snp4
}
# Using the entity name
snp1 <- smpds::snapshot("juodonys_core")
snp1
#> # A tibble: 1 × 6
#>   ID_SITE ID_ENTITY ID_SAMPLE site_name entity_name   pollen_counts$clean
#>     <int>     <int>     <int> <chr>     <chr>                       <int>
#> 1    3890      7901         1 Juodonys  juodonys_core                   1
#> # … with 2 more variables: pollen_counts$intermediate <int>, $amalgamated <int>

# Using the site name
snp2 <- smpds::snapshot("Petresiunai", use_site_name = TRUE)
snp2
#> # A tibble: 1 × 6
#>   ID_SITE ID_ENTITY ID_SAMPLE site_name   entity_name     pollen_counts$clean
#>     <int>     <int>     <int> <chr>       <chr>                         <int>
#> 1    6690     14229         2 Petresiunai petresiunai_121                   1
#> # … with 2 more variables: pollen_counts$intermediate <int>, $amalgamated <int>
# Using the ID_ENTITY
snp1 <- smpds::snapshot(1)
snp1
#> # A tibble: 1 × 6
#>   ID_SITE ID_ENTITY ID_SAMPLE site_name entity_name pollen_counts$clean
#>     <int>     <int>     <int> <chr>     <chr>                     <int>
#> 1       1         1      9709 05-Mo     05-Mo                         1
#> # … with 2 more variables: pollen_counts$intermediate <int>, $amalgamated <int>

# Using the ID_SITE
snp2 <- smpds::snapshot(2, use_id_site = TRUE)
snp2
#> # A tibble: 1 × 6
#>   ID_SITE ID_ENTITY ID_SAMPLE site_name  entity_name pollen_counts$clean
#>     <int>     <int>     <int> <chr>      <chr>                     <int>
#> 1       2        36     15870 10 [HFL10] HFL10                         1
#> # … with 2 more variables: pollen_counts$intermediate <int>, $amalgamated <int>
# Using the entity table
`%>%` <- magrittr::`%>%`
snp1 <- smpds::entity %>%
  dplyr::slice(1) %>%
  smpds::snapshot()
snp1
#> # A tibble: 1 × 6
#>   ID_SITE ID_ENTITY ID_SAMPLE site_name entity_name pollen_counts$clean
#>     <int>     <int>     <int> <chr>     <chr>                     <int>
#> 1       1         1      9709 05-Mo     05-Mo                         1
#> # … with 2 more variables: pollen_counts$intermediate <int>, $amalgamated <int>

# Using a custom data frame (`tibble` object) with site names
snp2 <- tibble::tibble(
    site_name = c("Aligol lake", "Big Sandy Creek")
  ) %>%
  smpds::snapshot()
snp2
#> # A tibble: 7 × 6
#>   ID_SITE ID_ENTITY ID_SAMPLE site_name       entity_name     pollen_counts$cle…
#>     <int>     <int>     <int> <chr>           <chr>                        <int>
#> 1     158       317      6066 Aligol lake     Aligol core_0                    7
#> 2     158       318      6067 Aligol lake     Aligol core_4                    7
#> 3     158       319      6068 Aligol lake     Aligol core_8                    7
#> 4     158       320     17764 Aligol lake     Connor_a1 (AL1)                  7
#> 5     158       321     17765 Aligol lake     Connor_a2 (AL2)                  7
#> 6     158       322     17766 Aligol lake     Connor_a3 (AL3)                  7
#> 7     772      1683     14037 Big Sandy Creek BIGSANDY                         7
#> # … with 2 more variables: pollen_counts$intermediate <int>, $amalgamated <int>