[R] extract and re-arrange components of data frame
    S Ellison 
    S@E|||@on @end|ng |rom LGCGroup@com
       
    Tue Jun 12 17:13:01 CEST 2018
    
    
  
> #I need to get this final result
> r<-data.frame(i=c(1,1,1,2,2,3), s=c(97, 98, 99, 103, 105, 118))
Nothing magic to suggest.
But maybe:
list.s <- strsplit(d$s,",")
r <- data.frame(i=rep(d$i, times=sapply(list.s, length)), s=unlist(list.s), stringsAsFactors=FALSE )
S Ellison
*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}
    
    
More information about the R-help
mailing list