Abhinav Karthik Posted February 14, 2022 Share Posted February 14, 2022 For example, if i want to create a new column from the data in column A -> all words starting with the letters "te". Ideally if there are two words starting with "te", I would like to return the first instance. Please see example below: Exisiting Column A A texting from new phone telephone call is enough what do you want to tell the tennis ball is new Result texting telephone tell tennis Link to comment Share on other sites More sharing options...
Fabian Duerr Posted February 15, 2022 Share Posted February 15, 2022 You can create your own expression function and use it for the calculated column. There are several ways to extract parts of a string with R using regular expressions. For convenience I use the stringr package for my example. Make sure you have it installed. If not, go to TOOLS -> TERR TOOLS -> Package Management -> Load -> and install stringr (You could also use stringi package or base R) Then creat an expression gunction. Go to DATA -> Data Function Properties -> Expression Functions -> New Name: StringExtract, Type: Column function, Return type: String, Category: Text functions StringExtract Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now