Skip to content
Prev 248017 / 398503 Next

complex transformation of data

Den
That great! It's working! Thank you so much!
It is a pure magic which makes my head spin.
aggregate(.~ id, lapply(df, as.character), FUN =
function(x)paste(sort(x), collapse = ''), na.action = na.pass)

1. help says:
 Note that ?paste()? coerces ?NA_character_?, the character missing
value, to ?"NA"'
And at the same time:
 ?na.pass? returns the object unchanged.
I am happy, that I don't have NAs in mydata.  I just don't understand
how
it happened.
2. Can't see the real difference between 'FUN = function(x) paste(x)'
and 'FUN = paste'. However, former working perfectly while latter simply
not.
3.Finally, all help says about LHS in formulas like '.~id' is that it's
name is "dot notation". And not a single word more. Thus, I have no
clue, what dot in that formula really means.


Conclusion:
1. It's a magic. 
2. You definitely saved my investigation. (When I've started I had no
idea it would be so difficult to arrange those chemotherapy cycles in
dataframe, although I dare to call myself pharmacoepidemiologist (which
sounds rather funny after that story))
3. THANK YOU!!!!!!

Sincerely yours 
Denis Kazakiewicz
Belarus 


? ???, 21/01/2011 ? 18:37 -0200, Henrique Dallazuanna ????: