File tree Expand file tree Collapse file tree 2 files changed +7
-15
lines changed Expand file tree Collapse file tree 2 files changed +7
-15
lines changed Original file line number Diff line number Diff line change @@ -284,12 +284,8 @@ na_as <- function(x) {
284
284
}
285
285
286
286
get_class <- function (x ) {
287
- foo <- function (x ) {
288
- class(x )[1 ]
289
- }
290
-
291
- if (is.list(x ) || is.data.frame(x )) {
292
- vapply(x , foo , character (1 ))
287
+ if (is.list(x )) {
288
+ vapply(x , function (x ) class(x )[1 ], character (1 ))
293
289
} else {
294
290
class(x )[1 ]
295
291
}
Original file line number Diff line number Diff line change @@ -338,17 +338,13 @@ test_that("na_as() | general test", {
338
338
})
339
339
340
340
test_that(" get_class() | general test" , {
341
- foo <- function (x ) {
342
- class(x )[1 ]
343
- }
341
+ test <- function (x ) class(x )[1 ]
344
342
345
343
expect_equal(get_class(1 ), " numeric" )
346
-
347
- x <- datasets :: iris
348
- expect_equal(get_class(x ), vapply(x , foo , character (1 )))
349
-
350
- x <- list (a = 1 , b = 1 )
351
- expect_equal(get_class(x ), vapply(x , foo , character (1 )))
344
+ expect_equal(get_class(datasets :: iris ),
345
+ vapply(datasets :: iris , test , character (1 )))
346
+ expect_equal(get_class(list (a = 1 , b = 1 )),
347
+ vapply(list (a = 1 , b = 1 ), test , character (1 )))
352
348
})
353
349
354
350
test_that(" fix_character() | general test" , {
You can’t perform that action at this time.
0 commit comments