Skip to content

Commit

Permalink
factoring out genID call
Browse files Browse the repository at this point in the history
  • Loading branch information
nfultz committed Oct 20, 2017
1 parent 151a9a9 commit ed14837
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions R/fabricate.R
Expand Up @@ -127,13 +127,18 @@ fabricate_data_single_level <- function(data = NULL,
", you must provide a single number to N."
)
}
data <- genID(data.frame(), ifelse(is.null(ID_label), "ID", ID_label), N)
} else if (!is.null(data)){
if (existing_ID == FALSE) {
data <- genID(data, ifelse(is.null(ID_label), "ID", ID_label))
}
data <- data.frame()
existing_ID <- FALSE
} else if(!is.null(data)){
N <- nrow(data)
}

if (!existing_ID) {
if(is.null(ID_label)) ID_label <- "ID"
data <- genID(data, ID_label, N)
}


fab(data, options)
}

Expand Down

0 comments on commit ed14837

Please sign in to comment.