some.RdRandomly select a few elements of an object, typically a data frame, matrix, vector, or list. If the object is a data frame or a matrix, then rows are sampled.
some(x, ...)
# S3 method for class 'data.frame'
some(x, n=10, cols=NULL, ...)
# S3 method for class 'matrix'
some(x, n=10, cols=NULL, ...)
# Default S3 method
some(x, n=10, ...)Sampled elements or rows.
Fox, J. and Weisberg, S. (2019) An R Companion to Applied Regression, Third Edition, Sage.
These functions are adapted from head and tail
in the utils package.
some(Duncan)
#> type income education prestige
#> minister prof 21 84 87
#> conductor wc 76 34 38
#> contractor prof 53 45 76
#> factory.owner prof 60 56 81
#> machinist bc 36 32 57
#> auto.repairman bc 22 22 26
#> truck.driver bc 21 15 13
#> barber bc 16 26 20
#> soda.clerk bc 12 30 6
#> janitor bc 7 20 8
some(Duncan, cols=names(Duncan)[1:3])
#> type income education
#> engineer prof 72 86
#> undertaker prof 42 74
#> lawyer prof 76 98
#> welfare.worker prof 41 84
#> conductor wc 76 34
#> contractor prof 53 45
#> store.manager prof 42 44
#> plumber bc 44 25
#> machine.operator bc 21 20
#> shoe.shiner bc 9 17