Searches through text for a particular term and displays a table showing the cases that contain that search term. This is useful when you try to understand the context of a specific word or phrase in your text. The input text can be a Text variable, a character vector in an R Output, or the processed text from a variable created by How to Setup Text for Analysis. If you use processed text to search, the table will display both the original text input as well as the processed text.
Requirements
- Requires one of the following:
- A Setup Text Analysis object
- A Text variable
- Or a character vector in a Calculation
Please note these steps require a Displayr license.
Method
- From the toolbar, click Anything > Advanced Analysis > Text Analysis > Advanced > Search.
- Under Data > Input select a Setup Text Analysis object, a Text variable, or a character vector in a Calculation.
- Enter a Search Term (in the below example, wine) and hit Enter.
In this example, we have first processed the text from a survey question that asked people the first thought that comes to mind about France, using How to Setup Text for Analysis. Since the text has been pre-processed, the table shows both the original text and the results of the processing. If you use a text variable or character vector under Data > Input then the result will instead be a single column containing the text only. The search term that is used is the word wine, and it appears in bold when it is identified in the processed text.
Extract processed text
To get an output that contains only the processed text (i.e., only responses that contain the search term), take these steps:
- From the toolbar, go to Calculation > Custom Code.
- Click onto the page to add the calculation.
- In the R Code editor, paste the code below, where text.search is the name of your Text Search output:
text.search$Processed.Text
Ensure that Calculate automatically is checked, or click Calculate.
Next
How to Setup Text for Analysis