[R-sig-Geo] Manipulate extract output

jm3389 jm3389 at columbia.edu
Tue Apr 26 05:10:36 CEST 2011


I works, I dont know why there is quote marks. But I can merge with other
data frames, so it's all good for me.

Thank you again for all your help Gustavo

> names(X) <- 1:length(X)
> X.stack <- cbind(Reduce(rbind, X), plot = rep(names(X), times = sapply(X,
NROW)))
> X.stack
        SMA-clipped_1           SMA-clipped_2           SMA-clipped_3
  plot
   [1,] "0.0850569680333138"    "0.525055825710297"     "0.391901522874832"
  "1"
   [2,] "0.115219570696354"     "0.433272808790207"     "0.48068830370903"
 "1"
   [3,] "0.0702793970704079"    "0.451244980096817"     "0.480365782976151"
  "1"
   [4,] "0.0702793970704079"    "0.451244980096817"     "0.480365782976151"
  "1"
   [5,] "0.105597451329231"     "0.470949500799179"     "0.450028508901596"
  "1"
   [6,] "0.103636965155602"     "0.436819821596146"     "0.457322180271149"
  "1"
   [7,] "0.0935368910431862"    "0.454399734735489"     "0.45674803853035"
 "1"
   [8,] "0.0935368910431862"    "0.454399734735489"     "0.45674803853035"
 "1"


---------------------------------------------------------
Joseph Muhlhausen
Project development researcher | CIESIN
61 Route 9W, PO Box 1000
Palisades, NY 10964 USA | 845-365-8935




On Mon, Apr 25, 2011 at 5:30 PM, Gustavo Carvalho [via R-sig-geo] <
ml-node+6303936-889868159-332023 at n2.nabble.com> wrote:

> Something like this should work:
>
> bleh <- structure(list(`1` = structure(list(a = 1:10, b = 21:30),
> .Names = c("a",
> "b"), row.names = c(NA, -10L), class = "data.frame"), `2` = structure(list(
>
>     a = 31:40, b = 41:50), .Names = c("a", "b"), row.names = c(NA,
> -10L), class = "data.frame"), `3` = structure(list(a = 51:60,
>     b = 61:70), .Names = c("a", "b"), row.names = c(NA, -10L), class =
> "data.frame")), .Names = c("1",
> "2", "3"))
>
> bleh
>
> cbind(Reduce(rbind, bleh), plot = rep(names(bleh), times = sapply(bleh,
> NROW)))
>
> Don't forget to set the names attribute of your list.
>
> Gustavo.
>
> On Mon, Apr 25, 2011 at 3:45 PM, jm3389 <[hidden email]<http://user/SendEmail.jtp?type=node&node=6303936&i=0&by-user=t>>
> wrote:
>
> > I have an additional question.
> >
> > I know have extracted multiple bands and my list layout has changed.
> >
> > [[50]]
> >      SMA-clipped_1 SMA-clipped_2 SMA-clipped_3
> >  [1,]  0.0632362440    0.14176662     0.8255592
> >  [2,]  0.1722273529    0.10599104     0.7607671
> >  [3,]  0.1722273529    0.10599104     0.7607671
> >  [4,]  0.2838407159    0.05971635     0.6902863
> >  [5,]  0.0257746875    0.15945776     0.8517801
> >  [6,]  0.2064613551    0.06632594     0.7841757
> >  [7,]  0.2064613551    0.06632594     0.7841757
> >  [8,]  0.2621570826    0.02389294     0.7842789
> >  [9,]  0.2310775816    0.04211631     0.7626599
> > [10,]  0.0287268255    0.18798502     0.8102853
> > [11,]  0.0848897994    0.09991057     0.8653935
> > [12,]  0.0848897994    0.09991057     0.8653935
> > [13,]  0.1673026830    0.01770168     0.8713655
> > [14,]  0.1527486742    0.03026910     0.8653567
> > [15,]  0.0003926796    0.14994104     0.8714772
> > [16,]  0.0003926796    0.14994104     0.8714772
> > [17,]  0.0026585322    0.10952766     0.9157249
> >
> > [[51]]
> >      SMA-clipped_1 SMA-clipped_2 SMA-clipped_3
> >  [1,]    0.15911901     0.3241347     0.5089146
> >  [2,]    0.15911150     0.3826110     0.4281845
> >  [3,]    0.15911150     0.3826110     0.4281845
> >  [4,]    0.10494564     0.2808739     0.5892844
> >  [5,]    0.14055550     0.2827841     0.5563493
> >  [6,]    0.13600963     0.3378267     0.4836067
> >
> >
> >
> > How can I get the same output but with this time 3 bands?
> >
> >      SMA-clipped_1 | SMA-clipped_2 | SMA-clipped_3 | Plot_ID
> > [1,]  0.0632362440    0.14176662     0.8255592             [[50]]
> >  [2,]  0.1722273529    0.10599104     0.7607671            [[50]]
> >  [3,]  0.1722273529    0.10599104     0.7607671            [[50]]
> >  [4,]  0.2838407159    0.05971635     0.6902863            [[50]]
> >  [5,]  0.0257746875    0.15945776     0.8517801            [[50]]
> >  [6,]  0.2064613551    0.06632594     0.7841757            [[50]]
> >  [7,]  0.2064613551    0.06632594     0.7841757            [[50]]
> >  [8,]  0.2621570826    0.02389294     0.7842789            [[50]]
> >  [9,]  0.2310775816    0.04211631     0.7626599            [[50]]
> > [10,]  0.0287268255    0.18798502     0.8102853           [[50]]
> > [11,]  0.0848897994    0.09991057     0.8653935           [[50]]
> > [12,]  0.0848897994    0.09991057     0.8653935           [[50]]
> > [13,]  0.1673026830    0.01770168     0.8713655           [[50]]
> > [14,]  0.1527486742    0.03026910     0.8653567           [[50]]
> > [15,]  0.0003926796    0.14994104     0.8714772           [[50]]
> > [16,]  0.0003926796    0.14994104     0.8714772           [[50]]
> > [17,]  0.0026585322    0.10952766     0.9157249           [[50]]
> >
> >
> > jm3389 wrote:
> >>
> >> My bad forgot to add utils::
> >>
> >> it's working ! Thanks a lot Gustavo
> >>
> >>>utils::stack(X)
> >>              values       ind
> >> 1     0.0850569680   1
> >> 2     0.1152195707   1
> >> 3     0.0702793971   1
> >> 4     0.0702793971   1
> >> 5     0.1055974513   1
> >> 6     0.1036369652   1
> >> 7     0.0935368910   1
> >> 8     0.0935368910   1
> >> 9     0.0967371687   1
> >> 10    0.1253680587   1
> >> 11    0.1569617689   1
> >> 12    0.0930611789   1
> >>
> >>
> >>>
> >>>  On Sun, Apr 24, 2011 at 11:15 AM, Gustavo Carvalho [via R-sig-geo] <
> >>>  [hidden
> >>> email]<
> http://user/SendEmail.jtp?type=node&node=6301600&i=1&by-user=t&gt<http://user/SendEmail.jtp?type=node&node=6301600&i=1&by-user=t&gt>
> ;>
> >>> wrote:
> >>> >
> >>> >> Dear Joseph,
> >>> >>
> >>> >> Could you please try this?
> >>> >>
> >>> >> names(X) <- 1:length(X)
> >>> >> stack(X)
> >>
> >>
> >
> >
> > --
> > View this message in context:
> http://r-sig-geo.2731867.n2.nabble.com/Manipulate-extract-output-tp6301073p6303557.html<http://r-sig-geo.2731867.n2.nabble.com/Manipulate-extract-output-tp6301073p6303557.html?by-user=t>
>
> > Sent from the R-sig-geo mailing list archive at Nabble.com.
> >
> > _______________________________________________
> > R-sig-Geo mailing list
> > [hidden email]<http://user/SendEmail.jtp?type=node&node=6303936&i=1&by-user=t>
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]<http://user/SendEmail.jtp?type=node&node=6303936&i=2&by-user=t>
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://r-sig-geo.2731867.n2.nabble.com/Manipulate-extract-output-tp6301073p6303936.html
>  To unsubscribe from Manipulate extract output, click here<http://r-sig-geo.2731867.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=6301073&code=am0zMzg5QGNvbHVtYmlhLmVkdXw2MzAxMDczfDkxNTAzOTkyNg==>.
>
>


--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Manipulate-extract-output-tp6301073p6304478.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list