[R] turning a list of objects into columns

2019-06-30 Thread Gerrit Draisma
Ha Janet, Does this reshape do what you want: df = read.table(header=TRUE,text=" scen streamflowtrans evap psn 1 0.019234 1.658967 0.002883 0.002391 1 0.019027 1.661192 0.002844 0.003142 2 0.018821 1.695623 0.003192 0.002167 2 0.018619 1.503481 0.002536 0.003059 3 0.018425

Re: [R] turning a list of objects into columns

2019-06-29 Thread Jeff Newmiller
Maybe look at reshape2? e.g. https://seananderson.ca/2013/10/19/reshape/ There is a very capable base R reshape function, but I find it quite challenging to apply. Note that you normally want to retain one or more columns to identify each row in your result... but I am not sure I see anything s

Re: [R] turning a list of objects into columns

2019-06-29 Thread Eric Berger
Hi Janet, I am not sure what your problem is. It seems that the code you wrote is doing what you want. The command 'head(tmp2$X1)' is outputting a numeric vector, not a list. Eric On Sat, Jun 29, 2019 at 9:28 PM Janet Choate wrote: > Hi, > I have a data frame that looks something like this (bu

[R] turning a list of objects into columns

2019-06-29 Thread Janet Choate
Hi, I have a data frame that looks something like this (but much longer): df scen streamflowtrans evap psn 1 0.019234 1.658967 0.002883 0.002391 1 0.019027 1.661192 0.002844 0.003142 2 0.018821 1.695623 0.003192 0.002167 2 0.018619 1.503481 0.002536 0.003059 3 0.018425 0.