From 58695e86bce7bce53bb3961a3b3fb4e78abc4fc6 Mon Sep 17 00:00:00 2001 From: go_gonzo Date: Wed, 13 Nov 2024 12:23:31 +0100 Subject: [PATCH] fix --- R/teal_data-class.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/teal_data-class.R b/R/teal_data-class.R index 85ce9e3bc..404fd72bd 100644 --- a/R/teal_data-class.R +++ b/R/teal_data-class.R @@ -107,17 +107,17 @@ code2list <- function(code) { parsed_code <- parse(text = code, keep.source = TRUE) - if (length(parsed_code)) { + code_list <- if (length(parsed_code)) { lapply(split_code(code), function(current_code) { - attr(current_code, "id") <- sample.int(.Machine$integer.max, 1) parsed_code <- parse(text = current_code, keep.source = TRUE) attr(current_code, "dependency") <- extract_dependency(parsed_code) current_code }) } else { # empty code like "", or just comments - attr(code, "id") <- sample.int(.Machine$integer.max, size = 1) attr(code, "dependency") <- extract_dependency(parsed_code) # in case comment contains @linksto tag list(code) } + names(code_list) <- sample.int(.Machine$integer.max, length(code_list)) + code_list }