This is an old revision of the document!


Text Analysis

Initializing text

To start doing any type of text analysis, you need to initialize the text so R knows how to interpret it. The way to do this is by using the initializeText() function,

TwitterText = initializeText(twitterwithdate$message)

As with everything else, you need to give your new data a name so it doesn’t just print out in the Console. After running this command, you should be able to see your new variable in the Workspace tab, as in Figure 22
However, if you click on it, you’ll likely get a warning like the one in Figure 23

Text initialized Text initialized, as seen in the Workspace pane.

Text preview warning Warning about previewing text data- I recommend saying “No”

Looking at Text Data

If you want to look at text data and not get a warning like the one in 23, use the command inspect() and the head() command,

inspect(head(TwitterText))
 
 
## A corpus with 6 text documents
##
## The metadata consists of 2 tag-value pairs and a data frame
## Available tags are:
##   create_date creator
## Available variables in the data frame are:
##   MetaID
##
## [[1]]
## Fat Jack s Erratic Rants: WARM WEATHER AND GAS SAVINGS: BUY A MOTORCYCLE: Spring is here. or at least
##
## [[2]]
## "Spring is here. And I am a flower. with nothing interesting to say." Who said it? :-)
##
## [[3]]
## Ants are starting to invade my bathroom. Guess that means spring is here. Grrrrr
##
## [[4]]
## Im so bored spring is here.and so far it s going bad! :/
##
## [[5]]
## Guess Spring is here and must figure out what type of veg. to plant and more flowers.
##
## [[6]]
## @Royboi pretty good. finally feeling like spring is here. feeling all randy and ready for patio drink
Print/export