File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ format_model_data <- function(project,
8383 name ,
8484 alt_name ,
8585 zone_id ,
86- unique_obs_id ,
86+ unique_obs_id , # ADD ERROR CHECK
8787 select_vars = NULL ,
8888 aux_data = NULL ,
8989 aux_key = NULL ,
@@ -116,6 +116,13 @@ format_model_data <- function(project,
116116 # Format main data ------------------------------------------------------------------------------
117117 # Load main data table
118118 original_dataset <- table_view(paste0(project , " MainDataTable" ), project )
119+
120+ # Check unique_obs_id
121+ if (! (nrow(unique(original_dataset [unique_obs_id ])) == nrow(original_dataset ))) {
122+ stop(" The unique_obs_id is not unique for each observation (row). Select a new variable
123+ or create a new ID variable unique to each observation." )
124+ }
125+
119126 # Load alternative choice list
120127 alt_list_all <- unserialize_table(paste0(project , " AltMatrix" ), project )
121128
You can’t perform that action at this time.
0 commit comments