Cautionary note on the solution below. Be sure the 'sndr' is either
factor or character because, if sndr is numeric, as the list is
populated, R will fill in non-adjacent list items with NULLs, leaving a
list with many empty entries. So, the modified line is
newdat[[as.character(vnam)]]<
This is a (very) slightly modified version of Jim's reply that takes the
sender's email our of the list element and uses it as the name so it can
be accessed as newdat$'senders email' or newdat[['senders email']]
newdat<-list()
for(sndr in unique(rdvdf$sender)) {
newvec<-
as.character(unique
On Fri, 11 Jul 2014 12:19:39 PM Ryan de Vera wrote:
> Hello all,
>
> I have a data frame filled with senders and recipients. Some of the
senders
> have multiple rows with different recipients and I want to merge
those
> rows. For example I have
>
> a...@email.com b...@email.com
> a...@email
Hi John,
I don't think your x2 is right, but who knows?
One possible approach would be:
R> lapply(split(x2$recipients, unique(x2$sender)), paste, collapse=", ")
$`a...@email.com`
[1] "b...@email.com, f...@email.com"
$`r...@email.com`
[1] "c(\"c...@email.com\", \"d...@email.com\"), h...@email.co
Hi Ryan,
We can't tell from your example what structure your original data are
in, nor what your output is intended to look like, or for that matter
how you got from one to the other. Please don't post in HTML because
it gets mangled!
Using dput() to provide your example data is the best thing, b
Hello all,
I have a data frame filled with senders and recipients. Some of the senders
have multiple rows with different recipients and I want to merge those
rows. For example I have
a...@email.com b...@email.com
a...@email.com c...@email.com d...@email.com
r...@email.com f...@em
6 matches
Mail list logo