Hi,

name of the data.frame is assumed to be dt.

cnt.tmp <- strsplit(dt$Author, " ")
cnt <- sapply(cnt.tmp, length)
paper.cnt <- dt$Paper[cnt]
author <- unlist(cnt.tmp)
year <- dt$Year[cnt]

dt.new <- data.frame(Paper = paper.cnt, Author = author, Year = year)

HTH,
Dong-hyun Oh

On Aug 27, 2008, at 9:27 PM, Grant Gillis wrote:

Hello all and thanks in advance for any help or direction.  I have
co-authorship data that looks like:


Paper    Author                      Year
1       SmithKK  JonesSD       2008
2       WallaceAR  DarwinCA  1999
3       HawkingS                    2003


I would like:
Paper      Author              Year
1         SmithKK               2008
1         JonesSD               2008
2         WallaceAR           1999
2          DarwinCA            1999
3          HawkingS            2003



Thanks for your patience with what is likely an easy question
<r-help@r-project.org>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to