Skip to contents

This function prepares a user_data dataframe for upload by adding a 'Control' column (generated from Density and CompositionID values), and by adding 'Created' and 'LastUpdated' columns with the current timestamp.

Usage

prepare_control_for_upload(user_data, now)

Arguments

user_data

A dataframe with user data containing 'Density' and 'CompositionID' columns.

now

A timestamp indicating the current time.

Value

A dataframe with additional columns 'Control', 'Created', and 'LastUpdated'.

Examples

test_data <- data.frame(Density = c(100, 1000, 1500),
                        CompositionID = c("S1_1", "S3_2", "S2_2"))
prepare_control_for_upload(test_data, Sys.time())
#>   Density CompositionID   Control             Created         LastUpdated
#> 1     100          S1_1  100_S1_1 2024-10-17 22:16:23 2024-10-17 22:16:23
#> 2    1000          S3_2   1K_S3_2 2024-10-17 22:16:23 2024-10-17 22:16:23
#> 3    1500          S2_2 1.5K_S2_2 2024-10-17 22:16:23 2024-10-17 22:16:23