Skip to content

Commit 3b0d1ca

Browse files
committed
Refactor
1 parent 1691d9f commit 3b0d1ca

File tree

1 file changed

+15
-23
lines changed

1 file changed

+15
-23
lines changed

R/read_ods.R

+15-23
Original file line numberDiff line numberDiff line change
@@ -44,29 +44,21 @@
4444
} else {
4545
max_row <- n_max + 1
4646
}
47-
limits <- c(
48-
min_row = skip + 1,
49-
max_row = max_row,
50-
min_col = 1,
51-
max_col = -1
52-
)
53-
} else {
54-
if(skip != 0 || n_max != Inf) {
55-
warning("Range and non-default value for skip or n_max given. Defaulting to range.", call. = FALSE)
56-
}
57-
tryCatch({
58-
limits <- cellranger::as.cell_limits(range)
59-
}, error = function(e) {
60-
stop("Invalid `range`")
61-
})
62-
limits <- c(
63-
min_row = limits[["ul"]][1],
64-
max_row = limits[["lr"]][1],
65-
min_col = limits[["ul"]][2],
66-
max_col = limits[["lr"]][2]
67-
)
68-
}
69-
return(limits)
47+
return(c(min_row = skip + 1, max_row = max_row, min_col = 1, max_col = -1))
48+
}
49+
if(skip != 0 || n_max != Inf) {
50+
warning("Range and non-default value for skip or n_max given. Defaulting to range.", call. = FALSE)
51+
}
52+
tryCatch({
53+
limits <- cellranger::as.cell_limits(range)
54+
}, error = function(e) {
55+
stop("Invalid `range`")
56+
})
57+
return(c(min_row = limits[["ul"]][1],
58+
max_row = limits[["lr"]][1],
59+
min_col = limits[["ul"]][2],
60+
max_col = limits[["lr"]][2]
61+
))
7062
}
7163

7264
.convert_strings_to_factors <- function(df) {

0 commit comments

Comments
 (0)