knitr::opts_chunk$set(echo = TRUE) devtools::load_all()
First we grab the ISO2k data and the standardization tables
library(lipdR) iso2k <- readLipd("https://lipdverse.org/iso2k/current_version/iso2k1_0_1.zip")
And now we'll convert that to a LiPD TS object
TS <- as.lipdTs(iso2k)
First, update the metadata
TS1 <- updateMetaDataFromStandardTables(TS, "paleoData_units")
This function produces an updated TS object as well as a data frame showing the changes
standardizeValue()
looks for synonyms and replaces them with valid lipd names
TS2 <- standardizeValue(lipdTS=TS1$TS, key="paleoData_units")
A quick sanity check
isValidValue(TS2$TS, "paleoData_units") TS[[2]]$paleoData_units TS2$TS[[2]]$paleoData_units
Finally we can update either paleoData_notes
or notes
with the changes made
TS1 <- lipdR:::updateNotes(lipdTS=TS2$TS, key = "paleoData_units", metadataChangesDF=TS1$ChangesDF, standardizeSynonymDF=TS2$synonymDF$synonymDF)
Let's have a look at some examples
unchanged
TS[[1]]$paleoData_notes TS1[[1]]$paleoData_notes
TS[[2]]$paleoData_notes TS1[[2]]$paleoData_notes
TS[[240]]$paleoData_notes TS1[[240]]$paleoData_notes
Now let's try this for a more complicated key
TS1 <- updateMetaDataFromStandardTables(TS, "interpretation_seasonality") TS1
There is no metadata to update this time
Let's try standardizing
TS2 <- standardizeValue(TS, "interpretation_seasonality")
We see a long string of output here, reflecting the 7 unique interpretation_seasonality keys
Let's have a look now
a2 <- isValidValue(lipdTS=TS2$TS, key="interpretation_seasonality")
Cool, that took care of all of them
An example of values changed
TS[[1851]]$interpretation5_seasonality TS2$TS[[1851]]$interpretation5_seasonality
TS1 <- lipdR:::updateNotes(lipdTS=TS2$TS, standardizeSynonymDF=TS2$synonymDF[[1]]$synonymDF)
TS[[328]]$notes TS1[[328]]$notes
TS1 <- lipdR:::updateNotes(lipdTS=TS2$TS, standardizeSynonymDF=TS2$synonymDF[[5]]$synonymDF)
TS[[1851]]$notes TS1[[1851]]$notes
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.