@@ -75,6 +75,13 @@ to_vector <- function(lst) {
7575# '
7676build_frame <- function (... , cf_eval_environment = parent.frame()) {
7777 v <- as.list(substitute(list (... )))
78+ lengths <- vapply(
79+ v ,
80+ function (vi ) {nchar(paste(as.character(vi ), collapse = ' ' ))},
81+ numeric (1 ))
82+ if (any(lengths < = 0 )) {
83+ stop(" empty entry, this is often caused by an extra comma" )
84+ }
7885 v <- lapply(seqi(2 , length(v )), function (i ) {v [[i ]]})
7986 force(cf_eval_environment )
8087 lv <- length(v )
@@ -382,6 +389,13 @@ qchar_frame <- function(...) {
382389 if (lv < 1 ) {
383390 return (data.frame ())
384391 }
392+ lengths <- vapply(
393+ v ,
394+ function (vi ) {nchar(paste(as.character(vi ), collapse = ' ' ))},
395+ numeric (1 ))
396+ if (any(lengths < = 0 )) {
397+ stop(" empty entry, this is often caused by an extra comma" )
398+ }
385399 # inspect input
386400 cls <- vapply(v , class , character (1 ))
387401 if (length(setdiff(cls , c(" call" , " character" , " name" , " numeric" , " integer" , " logical" , " factor" )))> 0 ) {
@@ -419,7 +433,7 @@ qchar_frame <- function(...) {
419433 ncell <- length(vu )
420434 nrow <- ncell / ncol
421435 if (abs(nrow - round(nrow ))> 0.1 ) {
422- stop(" wrapr::qchar_frame confused as to cell count" )
436+ stop(" wrapr::qchar_frame confused as to cell count (this can be an extra comma or mis-placed separator) " )
423437 }
424438 fr <- as.data.frame(matrix (data = vu [- seq_len(ncol )],
425439 ncol = ncol ,
0 commit comments