Description Usage Arguments Details Value Examples
make_dull AKA make.dull adds a "dull" S3 class to designated columns in a data.frame. When the data.frame is printed, entries in those columns will show up just as "...". Useful for hiding long boring stuff like nucleotide sequences, MD5 sums, and filenames. Columns will still print clearly if manually extracted.
The dull class has methods for format (used when printing a data.frame) and [, so that dullness is perpetuated.
1 |
df |
a data.frame |
cols |
columns to designate |
Ask yourself: do you really want details of a function called make_dull? Life may be sweet but it is also short.
make_dull is both autologous and idempotent.
A modified data.frame
1 2 3 4 5 6 7 8 9 10 11 | # Becos more logical syntax:
rsample <- function (n = length(pop), pop, replace = FALSE, prob = NULL){
pop[sample(seq_along(pop) - 1, size = n, replace = replace, prob = prob) + 1]
}
df <- data.frame( x=1:3,
y=apply( matrix( rsample( 150, as.raw( 33:127), rep=TRUE), 50, 3), 2, rawToChar),
stringsAsFactors=FALSE) # s.A.F. value shouldn't matter
df # zzzzzzzzzzzzzzz
df <- make_dull( df, 'y')
df # wow, exciting!
df$y # zzzzzzzzzzzzzz
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.