I'm sorry Grant, my bad. To reproduce what you'd like to do, my previous
code should be:


x="Paper,    Author, Year
1,SmithKK JonesSD,       2008
2,WallaceAR DarwinCA,  1999
3,HawkingS,                     2003"

X=read.delim2(textConnection(x),sep=",",header=TRUE)
closeAllConnections()

author= strsplit(as.character(X$Author)," ")
l=lapply(author,length)
P=rep(X$Paper,l)
Y=rep(X$Year,l)

 X.new=data.frame(Paper=P,Author=unlist(author),Year=Y)
 X.new

HTH,

Jorge



On Wed, Aug 27, 2008 at 3:59 PM, Jorge Ivan Velez
<[EMAIL PROTECTED]>wrote:

>
> Dear Grant,
>
> Try this:
>
> x="Paper,    Author, Year
> 1,SmithKK JonesSD,       2008
> 2,WallaceAR DarwinCA,  1999
> 3,HawkingS,                     2003"
>
> X=read.delim2(textConnection(x),sep=",",header=TRUE)
> closeAllConnections()
>
> author= strsplit(as.character(X$Author)," ")
> l=lapply(author,length)
> P=rep(X$Paper,l)
> Y=P=rep(X$Year,l)
>
> X.new=data.frame(Paper=P,Authore=unlist(author),Year=Y)
> X.new
>
>
> HTH,
>
> Jorge
>
>
>
> On Wed, Aug 27, 2008 at 3:27 PM, Grant Gillis <[EMAIL PROTECTED]>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.
>>
>
>
>

        [[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.

Reply via email to