Arstra Van den Hoops lamarque D # initial present.
I tried this case with Rui's solution:
fun2(pubnew)
#[[1]]
#[1] " Brown" "Santos" "Rome" "Don Juan"
#[[2]]
#[1] "Benigni"
#
#[[3]]
#[1] "Arstra" "Van den Hoo
thanks, it works well. I have to work on Arun's previous answer to make it work
too.
David
>
> De : Rui Barradas
>À : Biau David
>Cc : r help list
>Envoyé le : Mercredi 23 janvier 2013 19h57
>Objet : Re: [R] extracting characters
V2 V3 V4
#1 Brown Santos Rome Don Juan
#2 Benigni
#3 Arstra Van den Hoops lamarque
A.K.
- Original Message -
From: Biau David
To: r help list
Cc:
Sent: Wednesday, January 23, 2013 12:38 PM
Subject: [R]
Hello,
I've just noticed that my first solution would only return the first set
of alphabetic characters, such as "Van", not "Van den Hoops".
The following will solve that problem.
fun2 <- function(x, sep = ", "){
x <- strsplit(x, sep)
m <- lapply(x, function(y) gregexpr(" [[:
Hello,
Try the following.
fun <- function(x, sep = ", "){
s <- unlist(strsplit(x, sep))
regmatches(s, regexpr("[[:alpha:]]*", s))
}
fun(pub)
Hope this helps,
Rui Barradas
Em 23-01-2013 17:38, Biau David escreveu:
Dear All,
I have a data frame of vectors of publication name
1. Study a regular expression tutorial on the web to learn how to do this.
2. ?regex in R summarizes (tersely! -- but clearly) R's regex's.
3. ?grep tells you about R's regular expression manipulation functions.
-- Bert
On Wed, Jan 23, 2013 at 9:38 AM, Biau David wrote:
> Dear All,
>
> I have
Dear All,
I have a data frame of vectors of publication names such as 'pub':
pub1 <- c('Brown DK, Santos R, Rome DF, Don Juan X')
pub2 <- c('Benigni D')
pub3 <- c('Arstra SD, Van den Hoops DD, lamarque D')
pub <- rbind(pub1, pub2, pub3)
I would like to construct a dataframe with only author's
7 matches
Mail list logo