Posts Tagged ‘ regex ’

How to Extract Citation from a Body of Text

March 26, 2012
By
How to Extract Citation from a Body of Text

Say, you have a text and you want to retrieve the cited names and years of publication. You wouldn't want to this by hand, wouldn't you?Try the following approach:(the text sample comes from THIS freely available publication)library(stringr)(txt <- ...

Read more »

..Some More Regex Examples Added to Collection

November 25, 2011
By
..Some More Regex Examples Added to Collection

Find the below examples added to my list of regex-examples HERE. Read more »

Read more »

Some Simple but Propably Useful Regex Examples with R-Package stringr…

November 3, 2011
By
Some Simple but Propably Useful Regex Examples with R-Package stringr…

I found that examples for the use of regex in R are rather rare. Thus, I will provide some examples from my own learning materials - mostly stolen from the help pages, with small but maybe illustrative adaptions.ps: I will extent this list of examples...

Read more »

R talk on regular expressions (regex)

October 6, 2011
By
R talk on regular expressions (regex)

Regular expressions are a powerful in any language to manipulate, search, etc. data. For example:> fruit <- c("apple", "banana", "pear", "pineapple")> fruit "apple" "banana" "pear" "pineapple"> grep("a", fruit) # there is an ...

Read more »

Testing for valid variable names

July 3, 2011
By
Testing for valid variable names

I have something a fondness for ridiculous variable names, so it’s useful to be able to check whether my latest concoction is legitimate. More so if it is automatically generated. Not having an is_valid_variable_name function is one of those odd omissions from R, and the assign function doesn’t check validity. To recap, there are a

Read more »

Day #35 replacing characters

May 4, 2011
By

Today I had a meeting with Emmanuel. He is a guy from inside Janssen who is very good with R-scripts. He made a lot of great plots which I had to use for our reports. During the meeting we came to a conclusion that all the difficult R-scripting he did,...

Read more »