For example, I have an array of data in which some text descriptions are given as follows:
big Pool House
1 storey Warehouse
multiple Storage pool
Now, I want to code the text descriptions based on the sub-strings. For example, if there is string "pool" in a text, then I want to assign a numerical code (say, 101) to the whole text description.
If there are multiple strings in a text description (say, "storage" and "pool"), then I want to assign multiple codes to those descriptions and concatenate/paste the codes. For example, in case of the description - "multiple Storage pool" , I would assign the code (say, 102) to storage and 101 to pool. So, the result should be (102, 101).
Could anyone please suggest an R algorithm for this?