tospongebob: SpongeBob-Case Conversion : sPOngEBOb-CasE cOnVErsIoN

Description Usage Arguments Details Value Examples

View source: R/tospongebob.R

Description

tospongebob is an S3 generic function for converting text in R objects to Mocking SpongeBob case. The core method for character vectors will return the input character vector with case-converted elements. For other objects, it will attempt to appropriately find text and convert them.

tospongebob IS an S3 gENErIC FunCtIoN fOR cOnveRtIng Text IN r obJEcts To MocKinG SpOnGEbob CasE. tHe cOrE MEtHOd FoR CharActEr VECtorS wIll RetURN tHe INPuT chARaCTer VEcTOr WItH cASe-cONVeRTed ELeMenTS. foR oThER objECTs, iT wIlL aTtemPT tO APprOPrIAtELy fInd tEXt aNd cONvERT tHEm.

Usage

1

Arguments

x

object with text to be converted to Mocking SpongeBob case.

...

onlY hERe tO sATisFy R CMd CHeCk.

Details

This section describes the (non-exported) S3 methods in more detail.

The core tospongebob.character method takes an input character vector and returns the same vector with its elements converted to Mocking SpongeBob case. Names of the vector are also converted unless parameter convert.names = FALSE. This method is then leveraged by all other methods.

The default tospongebob.default method will iterate through any elements of list-like objects and attempt to convert those. It will also convert the names of the object unless parameter convert.names = FALSE. NULL values are passed through as NULL.

Additional S3 methods for the following classes have been implemented:

tospongebob.array

: convert data and dimnames of an array

tospongebob.data.frame

: convert row names, column names, and convertible columns of a data.frame

tospongebob.environment

: create a copy of an environment with its objects converted

tospongebob.factor

: convert levels of factor vectors

tospongebob.fortune

: convert the content of a fortunes::fortune object

tospongebob.function

: deparse function into a character vector, convert, and then combine into one string block

tospongebob.ggplot

: convert text labels in ggplot2::ggplot object

matrix

: convert data and dimnames of a matrix

tospongebob.table

: convert data and dimnames of a table

Value

object with its text converted to Mocking SpongeBob case. ObjECt WiTH iTS tEXt CONvErTeD TO mOCkinG SponGEBob CasE.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
tospongebob("SpongeBob-Case Conversion")
tospongebob(c("S3 generic function", "Mocking SpongeBob case"))

tospongebob(packageDescription("base"))

df <- head(datasets::CO2)
tospongebob(df)

tospongebob(summary(df))

nicktoons <- list(
    spongebob = list(
        episodes = c("Help Wanted", "Reef Blower", "Tea at the Treedome"),
        characters = c("SpongeBob", "Patrick", "Squidward", "Sandy")
    ),
    hey_arnold = list(
        episodes = c("Downtown as Fruits", "Eugene's Bike"),
        characters = c("Arnold", "Gerald", "Helga")
    )
)
tospongebob(nicktoons)

Example output

[1] "sPONgEBob-cASE conVErSioN"
[1] "S3 GeNeRic fUncTIoN"    "MoCkiNg SpoNgEbob CAse"
pACKaGe: basE
VersIoN: 4.0.3
PRioRity: bAsE
TiTlE: THe r BaSe PACkAge
AUthoR: R cOrE TeAM And cONTriBUTorS WoRLDwiDe
maInTaIner: R cORe TEAm <R-corE@r-prOJect.Org>
deScrIPtIOn: bASe r FUNcTIOns.
licEnSE: pArT Of r 4.0.3
sUGGesTS: MethODs
buiLt: r 4.0.3; ; 2020-10-10 17:48:39 UtC; unIx

-- File: /usr/lib/R/library/base/Meta/package.rds 
  pLaNT   tyPE  TrEAtMEnT cOnc UptaKE
1   QN1 qUEbEC NoNcHIlLEd   95   16.0
2   QN1 qUEbEC NoNcHIlLEd  175   30.4
3   QN1 qUEbEC NoNcHIlLEd  250   34.8
4   QN1 qUEbEC NoNcHIlLEd  350   37.2
5   QN1 qUEbEC NoNcHIlLEd  500   35.3
6   QN1 qUEbEC NoNcHIlLEd  675   39.2
     pLaNt            tYPE        TrEAtmeNT      CONc           uPTaKE     
 Qn1    :6   QUeBeC     :6   NoncHIlleD:6   min.   : 95.0   MiN.   :16.00  
 qN2    :0   mISsiSSiPpI:0   cHiLleD   :0   1ST qU.:193.8   1sT qU.:31.50  
 QN3    :0                                  MeDiAn :300.0   MeDiAn :35.05  
 qc1    :0                                  mEaN   :340.8   MEaN   :32.15  
 Qc3    :0                                  3rd Qu.:462.5   3rD qU.:36.73  
 QC2    :0                                  maX.   :675.0   MAx.   :39.20  
 (oTHEr):0                                                                 
$SPonGeBoB
$SPonGeBoB$EPisoDES
[1] "hELP waNTEd"         "REeF bLOWeR"         "tEa AT ThE tReeDOmE"

$SPonGeBoB$cHArACTerS
[1] "spoNGeBOB" "PATricK"   "SQUiDWaRD" "saNDy"    


$hey_ArNolD
$hey_ArNolD$EPisODes
[1] "DOWntoWN As FRuITs" "EugeNe'S BiKe"     

$hey_ArNolD$ChAracTErs
[1] "ArNold" "GerAld" "HeLga" 

spongebob documentation built on May 2, 2019, 1:41 p.m.