Re: [R] complex transformation of data

2011-01-21 Thread 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

Re: [R] complex transformation of data

2011-01-21 Thread Den
Thank you for your efforts. Although it is still not working, it feels like getting closer and closer. id cycle1 cycle2 cycle3 1 1cmfcmfcmf 2 2mfcmfcmfc 3 3 acfNA acfNA NAcfm I really appreciate transformation from subsets ("c","m","f") to "cmf". That was critica

Re: [R] complex transformation of data

2011-01-21 Thread Henrique Dallazuanna
Just change the FUN function: aggregate(.~ id, lapply(df, as.character), FUN = function(x)paste(sort(x), collapse = ''), na.action = na.pass) On Fri, Jan 21, 2011 at 6:27 PM, Den wrote: > > Thank you for your efforts. > Although it is still not working, it feels like getting closer and > closer

Re: [R] complex transformation of data

2011-01-21 Thread Den
Dear Henrique Thank you again for helping me Unfortunately, your code seems not to be working > aggregate(.~ id, lapply(df, as.character), FUN = paste, collapse = "") id cycle1 cycle2 cycle3 1 1cmfcmfcmf 2 2mfcmfcmfc 3 3 cf cf cf (letter 'a' missing in df[

Re: [R] complex transformation of data

2011-01-21 Thread Henrique Dallazuanna
correction: aggregate(.~ id, lapply(df, as.character), FUN = paste, collapse = "", na.action = na.pass) On Fri, Jan 21, 2011 at 5:56 PM, Henrique Dallazuanna wrote: > Try this: > > aggregate(.~ id, lapply(replace(df, is.na(df), ''), as.character), FUN = > paste, collapse = "", na.action = na.pass

Re: [R] complex transformation of data

2011-01-21 Thread Henrique Dallazuanna
Try this: aggregate(.~ id, lapply(replace(df, is.na(df), ''), as.character), FUN = paste, collapse = "", na.action = na.pass) On Fri, Jan 21, 2011 at 5:45 PM, Den wrote: > Dear Henrique > Thank you again for helping me > Unfortunately, your code seems not to be working > > > aggregate(.~ id, la

Re: [R] complex transformation of data

2011-01-21 Thread Henrique Dallazuanna
Try this: aggregate(.~ id, lapply(test, as.character), FUN = paste, collapse = "") On Fri, Jan 21, 2011 at 10:25 AM, Den wrote: > Dear [R] people > Could you please help with following data transformation. > Any suggestions, hints, references and even guessing on performing any > of the followi

Re: [R] complex transformation of data

2011-01-21 Thread Moritz Grenke
for the first task ... Moritz __ Moritz Grenke http://www.360mix.de -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im Auftrag von Den Gesendet: Freitag, 21. Januar 2011 13:26 An: R-help Betreff: [R] complex transfor

Re: [R] complex transformation of data

2011-01-21 Thread ONKELINX, Thierry
that a reasonable answer can be extracted from a given body of data. ~ John Tukey > -Oorspronkelijk bericht- > Van: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] Namens Den > Verzonden: vrijdag 21 januari 2011 13:26 > Aan: R-help > Onderwerp: [R]

[R] complex transformation of data

2011-01-21 Thread Den
Dear [R] people Could you please help with following data transformation. Any suggestions, hints, references and even guessing on performing any of the following steps are highly appreciated. Those transformations are crucial for my work. (n_, _n, j_, k_ signify numbers) SOURCE DATA: id