Skip to content

Commit 3111cc6

Browse files
committed
lintrs
1 parent c0d63f0 commit 3111cc6

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

R/describe_distribution.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ describe_distribution.list <- function(x,
8282
num_el <- which(vapply(x, is.numeric, FUN.VALUE = logical(1L)))
8383

8484
# get elements names as is
85-
# ex: list(mtcars$mpg, mtcars$cyl) -> c("mtcars$mpg", "mtcars$cyl")
85+
# ex: `list(mtcars$mpg, mtcars$cyl) -> c("mtcars$mpg", "mtcars$cyl")`
8686
nm <- vapply(sys.call()[[2]], insight::safe_deparse, FUN.VALUE = character(1L))[-1]
8787

8888
if (isTRUE(include_factors)) {

R/to_numeric.R

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -219,15 +219,13 @@ to_numeric.factor <- function(x,
219219
# if the first observation was missing, add NA row and bind data frame
220220
if (i == 1 && na_values[i] == 1) {
221221
out <- rbind(NA, out)
222-
} else {
222+
} else if (na_values[i] == rows_x) {
223223
# if the last observation was NA, add NA row to data frame
224-
if (na_values[i] == rows_x) {
225-
out <- rbind(out, NA)
226-
} else {
227-
# else, pick rows from beginning to current NA value, add NA,
228-
# and rbind the remaining rows
229-
out <- rbind(out[1:(na_values[i] - 1), ], NA, out[na_values[i]:nrow(out), ])
230-
}
224+
out <- rbind(out, NA)
225+
} else {
226+
# else, pick rows from beginning to current NA value, add NA,
227+
# and rbind the remaining rows
228+
out <- rbind(out[1:(na_values[i] - 1), ], NA, out[na_values[i]:nrow(out), ])
231229
}
232230
}
233231
rownames(out) <- NULL

0 commit comments

Comments
 (0)