SillyR Package: 11 Functions to Help You in Your Text Analysis Workflow

Ifeanyi Idiaye
3 min readSep 7, 2023

--

SillyR package logo

In this post, I will introduce you to the SillyR package and its 11 helpful functions. This package puts the “fun” in function 😃.

Download & Install SillyR

For now, SillyR package is only available on GitHub. Therefore, to download and install it from the GitHub repository, run the code below in your R console, assuming you already have devtools installed:

devtools::install_github("Ifeanyi55/SillyR")

Having downloaded and installed the package in your R environment, the next thing is to load the package. Run the code below

library(SillyR)

Great! Let us now begin exploring its cool functions 😃.

Acronymize( )

This function turns any phrase into an acronym

phrase <- "international monetary fund"

Acronymize(phrase = phrase, separator = "")

# IMF

You can pass a dot (.) as your separator if you wish

is.acronym( )

This function checks if a string is an acronym. It returns a Boolean value

acronym <- "IMF"

is.acronym(string = acronym)

# TRUE

Capitalize( )

This function capitalizes any word passed to it

place <- "manhattan"

Capitalize(string = place)

# Manhattan

is.capitalized( )

This function checks if a string is capitalized. It returns a Boolean value

country <- "denmark"

is.capitalized(string = country)

# FALSE

anagramChecker( )

This function checks if two words are anagrams of each other. It returns a Boolean value

word_one <- "strap"
word_two <- "parts"

anagramChecker(word1 = word_one, word2 = word_two)

# TRUE

is.uppercase( )

This function checks if a word is in uppercase. It returns a Boolean value

word <- "HAPPY"

is.uppercase(string = word)

# TRUE

is.lowercase( )

This function checks if a word is in lowercase. It returns a Boolean value

word <- "attention"

is.lowercase(string = word)

# TRUE

palindromeExtract( )

This function extracts palindromes either from a sentence or a vector of string values

# extract palindromes from sentence
sentence <- "Dad bought mum a pop sweet"

palindromeExtract(input = sentence)

# Dad mum pop


# extract palindromes from vector
string_vec <- c("racecar", "flat", "bob", "mat", "tot")

palindromeExtract(input = string_vec)

# racecar bob tot

is.palindrome( )

This function checks whether a string input is a palindrome. It returns a Boolean value

string <- "peep"

is.palindrome(input = string)

# TRUE

rearrangeWays( )

This function tells you in how many ways a string can be rearranged. It can either return a numeric value or a one-sentence report

word <- "flash"

rearrangeWays(string = word, as_report = FALSE)

# 120

# as report
rearrangeWays(string = word, as_report = TRUE)

# flash can be rearranged in 120 possible ways

shorten.vector( )

This function shortens the length of a vector

fruits <- c("banana", "apples", "pear", "guava", "mango")

shorten.vector(vector = fruits, by = 2)

# "banana" "apples" "pear"

So, there you have it! You have been introduced to the SillyR package. I hope you find its functions helpful in your text analysis workflow.

Also, if you would like to recommend a function that can be added to the package, kindly drop a comment below or raise an issue on GitHub and I will be happy to write some code.

Don’t forget, if you enjoy using this package, kindly give the GitHub repository a ⭐️

GitHub: Ifeanyi55 (Ifeanyi Idiaye) (github.com)

Follow me on Medium: Ifeanyi Idiaye

Follow me on X (formerly Twitter): @Ifeanyidiaye

You can also read my other articles here:

Easily Convert PDF File to Word Using {Convert2Docx} R Package | by Ifeanyi Idiaye | Jul, 2023 | Medium

Build A Text-To-Image Application with Python and Open Journey in A Few Lines of Code | by Ifeanyi Idiaye | Aug, 2023 | Medium

How to Connect Local Folder on Your Computer to A GitHub Repository | by Ifeanyi Idiaye | Jul, 2023 | Medium

How to Deploy an R Shiny App as a Hugging Face Space | by Ifeanyi Idiaye | Medium

Build A Web Article Summarizer in R | by Ifeanyi Idiaye | Sep, 2023 | Medium

--

--

Ifeanyi Idiaye

I am a data scientist, who is passionate about AI and building AI-driven applications. I am also a data analytics developer and writer for Dev Genius.