Skip to Main Content
Florida Tech Evans Library Logo

Introduction to Text Mining

An overview of text mining tools and techniques.

str_length(string)

str_length(string) will return the width of a string. Note that str_length() will also count whitespaces contained within a string. 

str_pad(string, width, side)

str_pad() will append whitespace on the end of a string. 

Arguments: 

string = the variable or column containing the string you wish to pad. 

width =  a digit for the total length of the string once it has been padded with whitespaces. Note, specifying width = 30 on a string with 10 characters will result in a string of 30 characters. Specifying width = 30 on a string containing 20 characters will also return a padded string with 30 characters. The difference will be in the amount of whitespace added. 

side: the side you want to pad the string on. You can specify, "right", "left", or "both".

str_trim(string, side)

str_trim() will delete whitespace surrounding a string. This is useful for eliminating inconsistencies introduced by human error.

Arguments:

string = the variable or column containing the string you wish to pad.

side: the side you want to pad the string on. You can specify, "right", "left", or "both".