library(tm)
library(rpart)

#install.packages("readr")
#library("readr")

str <- "this is a sample for file #1 its contents are Mixed Case and it's not just text data 1234 and other numbers 5678"

# convert to lowercase:
str <- lapply(str, tolower)

# remove punctuation:
str <- lapply(str, removePunctuation)

# remove white spaces:
str <- lapply(str,stripWhitespace)

# remove stopwords:
str <- lapply(str,removeWords,stopwords("english"))

#str <- lapply(str,PlainTextDocument)
str

