Skip to content

Standard sample bracketing#25

Open
archaeothommy wants to merge 36 commits intomainfrom
FlowerDataProcessing
Open

Standard sample bracketing#25
archaeothommy wants to merge 36 commits intomainfrom
FlowerDataProcessing

Conversation

@archaeothommy
Copy link
Copy Markdown
Owner

@Andreaacme2: Is the function ready for merging? If not, what are the to dos?

@Andreaacme2
Copy link
Copy Markdown
Collaborator

Hi Thomas,

Let me take a last look at the code and documentation to see all the parameters are described. I will let you know asap.

@archaeothommy archaeothommy self-assigned this Dec 11, 2025
* consistent coding style
* remove unused variables and unecessary declarations
* remove implicit assumption that ID column has fixed name
* increase clarity and consistency of input and documentation.
* add additional input checks
@archaeothommy
Copy link
Copy Markdown
Owner Author

@Andreaacme2, I revised the function; see the message of e94dbc0 for a summary.

While going through the function, I saw:

  • Nothing is currently done with the input id_std. I assume this is in preparation for when cycle length becomes flexible and left it in.
  • You are labelling the column with the measurement uncertainty as "SE" but the standard deviation is calculated. What is correct here? I would expect, this to be SD throughout.
  • The output currently includes the standards as well. I am not sure if this is intentional or not.

For some reason, the append() functions in the SSB calculation return lists rather than vectors. The reason is most likely that the variables fed into them are of type data.frame/tibble rather than a vector. However, I was not able to figure out why this happens. I created a walkaround by unlist()-ing them before they are combined to the results data frame.

Please clean the folder data-raw and other folders from any leftovers that should not be included in the merge (e.g. the pdfs).

Three questions popped up:

  • While the function performs the SSB calculation, it does not calculate delta values. Should this be done in another function?
  • Why are averages and errors only calculated for the linearly corrected values?
  • What is the benefit of having the linearly calculated values reported when using weighted averages for calculation? The user could run the function just twice to compare the results if he wants to make this comparison, can't he?

Finally, two suggestions for future extension:

  • Turning the multiples of SD into user input. For example, oxygen isotopes are commonly reported in 1SD rather than 2SD. The respective column name in the output should reflect that, which can be easily achieved with e.g. names(results$SD) <- paste0(sd_input, "SD")
  • If the delta values are calculated in this function, it would be great to have it flexible in the notation (i.e., delta = factor 1000, epsilon = factor 10000, etc.). This could be rather neatly done by an input parameter notation = "delta" with a switch() statemet in the function body to pick the correct factor.

@Andreaacme2
Copy link
Copy Markdown
Collaborator

@archaeothommy Hi!
I started working with the comments related to the standard bracketing function. I have a question about to the third point of your comment. I run a test and the standards are not included on the output. Is it possible that you can send me the test you're using? I will work on the rest on the meantime.

I only left three files in the data-raw folder since I don't know if they are still needed or to who they belong. But I can delete them if you agree.

Thank you!

@archaeothommy
Copy link
Copy Markdown
Owner Author

Hi @Andreaacme2,
Thanks!

I think that the standards were included is my fault of not properly handling the data input. I do not have the code anymore but I used the ULB dataset and very likely overlooked that the standard was run several times without a sample in between at the beginning. So the code will report the standard because it assumes that every other row of it is a sample, as it actually should! (This might change after we improved the function to the extent that it uses the id_std input parameter.)

Regarding the files in data raw: I would keep the excel file as this was submitted by Alexandra as example for REE normalisation because this is a functionality that is yet to be implemented. The others can be deleted. If you do not want to delete your tidyverse approach of the SSB function, maybe you could move it to a new folder "drafts" or the like in the "dev_guide"? Not sure where to store store such files best...

Andreaacme2 and others added 4 commits January 22, 2026 14:31
-Addition of sd_input variable for displaying 1SD, 2SD, ..., nSD.
-Addition of SBB examples in the data_raw folder
@archaeothommy
Copy link
Copy Markdown
Owner Author

@Andreaacme2 Thank you so much for implementing the changes. The function looks awesome now! 🤩
I changed the possible values for indicating the notation because the previous ones were so similar that they were prone to typos.

Can I merge the function?

@Andreaacme2
Copy link
Copy Markdown
Collaborator

@archaeothommy No worries! and sounds good. You can merge the function now.
Later on I will see which other editings can be done to make the function more flexible.

@archaeothommy archaeothommy marked this pull request as ready for review February 9, 2026 23:32
@archaeothommy
Copy link
Copy Markdown
Owner Author

archaeothommy commented Feb 10, 2026

@Andreaacme2 : last question, lines 173-177 seems to be duplicates of lines 161-165 in the while-loop. Are they a leftover or is this on purpose?

archaeothommy and others added 3 commits February 9, 2026 19:28
-Addition of id_error parameter
-Change variable id_std for std
-change of variable values for id_values
-Changes in the main structure of the function by using the library dplyr
* update examples, test and vignette to new function structure
* revise documentation to include default values
* update column names of output to be closer to  the ASTR format
* declare dependencies
* linting
@archaeothommy
Copy link
Copy Markdown
Owner Author

archaeothommy commented Apr 12, 2026

Handling of the error is tricky... After your work during the CAA workshop, the function now requires a column with the analytical precisions. However,

  • The summary does not take the individual errors into account but calculates the SD based on the SSB corrected values. If intentional, this must be properly documented as one would expect otherwise because the errors must be given but are irrelevant for the summary output.
  • The detailed results report the errors for the invidual sample as intended. However,
    • The column name is "Error_err2SD" but based on the code, I think they are not in 2SD unless the input happens to be...
    • Mustn't the error be scaled together with the values when calculating the delta and epsilon notation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants