Skip to content

Commit 5ecea67

Browse files
committed
Change arguments check
1 parent b16949d commit 5ecea67

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

R/numerate.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ unmark = function(x, item = 2){
7575
unzip_list = function(x){
7676
all_lengths = unique(lengths(x))
7777
if(length(x)==0) return(x)
78-
if(length(all_lengths)!=1){
78+
(length(all_lengths) == 1) ||
7979
stop("each element of the argument 'x' should have the same length.")
80-
}
80+
8181
global_names = names(x)
8282
local_names = lapply(x, names)
8383
get_names = function(i){

R/to_list.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@
7272
#' str(res)
7373
to_list = function(expr){
7474
expr = substitute(expr)
75-
if(!is_loop(expr)) {
75+
is_loop(expr) ||
7676
stop(paste("argument should be expression with 'for', 'while' or 'repeat' but we have: ", deparse(expr, width.cutoff = 500)[1]))
77-
}
77+
7878

7979
expr = expand_loop_variables(expr)
8080
expr = add_assignment_to_final_loops(expr)
@@ -197,9 +197,9 @@ add_assignment_to_loop = function(expr, result_exists = FALSE){
197197
#' @export
198198
alter = function(expr, data = NULL){
199199
expr = substitute(expr)
200-
if(!is_loop(expr)) {
200+
is_loop(expr) ||
201201
stop(paste("argument should be expression with 'for', 'while' or 'repeat' but we have: ", deparse(expr, width.cutoff = 500)[1]))
202-
}
202+
203203
on.exit(suppressWarnings(rm(list = c(".___res", ".___counter", ".___curr"), envir = parent.frame())))
204204
if(is.null(data)) {
205205
data = expr[[3]]

0 commit comments

Comments
 (0)