[R] Reduce(paste, x) question

R. Michael Weylandt michael.weylandt at gmail.com
Thu Nov 1 20:35:57 CET 2012


On Thu, Nov 1, 2012 at 6:47 PM, mdvaan <mathijsdevaan at gmail.com> wrote:
> I have a question about the Reduce function:
>
> x <- list()
> x[[1]] <- LETTERS[1:5]
> x[[2]] <- LETTERS[11:15]
> Reduce(paste, x)
> [1] "A K" "B L" "C M" "D N" "E O"
>
> How do I get this?:
> [1] "A" "K"
> [2] "B" "L"
> [3] "C" "M"
> [4] "D" "N"
> [5] "E" "O"
>

Can you be specific as to what that output actually is? (Use dput() if
you don't mind) I'm not entirely sure what sort of R data structure
gives a printout like that by default.

Michael




More information about the R-help mailing list