Commit 48e3898 1 parent ffa95fd commit 48e3898 Copy full SHA for 48e3898
File tree 1 file changed +19
-5
lines changed
1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -341,8 +341,13 @@ wb_to_df <- function(
341
341
if (has_dims && length(keep_rows ) && length(keep_cols ))
342
342
cc <- cc [cc $ row_r %in% keep_rows & cc $ c_r %in% keep_cols , ]
343
343
344
- cc $ val <- NA_character_
345
- cc $ typ <- NA_character_
344
+ if (nrow(cc ) == 0 ) {
345
+ cc $ val <- character ()
346
+ cc $ typ <- character ()
347
+ } else {
348
+ cc $ val <- NA_character_
349
+ cc $ typ <- NA_character_
350
+ }
346
351
347
352
cc_tab <- unique(cc $ c_t )
348
353
@@ -402,7 +407,11 @@ wb_to_df <- function(
402
407
403
408
# if a cell is t="s" the content is a sst and not da date
404
409
if (detect_dates && missing(types )) {
405
- cc $ is_string <- FALSE
410
+ if (nrow(cc ) == 0 ) {
411
+ cc $ is_string <- logical ()
412
+ } else {
413
+ cc $ is_string <- FALSE
414
+ }
406
415
if (! is.null(cc $ c_t ))
407
416
cc $ is_string <- cc $ c_t %in% c(" s" , " str" , " b" , " inlineStr" )
408
417
@@ -481,8 +490,13 @@ wb_to_df <- function(
481
490
482
491
# prepare to create output object z
483
492
zz <- cc [c(" val" , " typ" )]
484
- zz $ cols <- NA_integer_
485
- zz $ rows <- NA_integer_
493
+ if (nrow(zz ) == 0 ) {
494
+ zz $ cols <- integer()
495
+ zz $ rows <- integer()
496
+ } else {
497
+ zz $ cols <- NA_integer_
498
+ zz $ rows <- NA_integer_
499
+ }
486
500
# we need to create the correct col and row position as integer starting at 0. Because we allow
487
501
# to select specific rows and columns, we must make sure that our zz cols and rows matches the
488
502
# z data frame.
You can’t perform that action at this time.
0 commit comments