diff options
Diffstat (limited to 'R/mkin_wide_to_long.R')
-rw-r--r-- | R/mkin_wide_to_long.R | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/R/mkin_wide_to_long.R b/R/mkin_wide_to_long.R index 6db2f337..21ab77b9 100644 --- a/R/mkin_wide_to_long.R +++ b/R/mkin_wide_to_long.R @@ -1,9 +1,9 @@ mkin_wide_to_long <- function(wide_data, time = "t")
{
colnames <- names(wide_data)
+ if (!(time %in% colnames)) stop("The data in wide format have to contain a variable named ", time, ".")
vars <- subset(colnames, colnames != time)
n <- length(colnames) - 1
- if (!(time %in% colnames)) stop("The data in wide format have to contain a variable named ", time, ".")
long_data <- data.frame(
name = rep(vars, each = length(wide_data[[time]])),
time = rep(wide_data[[time]], n),
|