Hi Kristi,
Try
out1970$smoot
HTH,
Jorge.-
On Fri, May 2, 2014 at 10:00 AM, Kristi Glover
<kristi.glover@hotmail.com>wrote:
> Hi R User,
> I am wonedring how I can extract a part of objects from list.
>
> For example
>
> > str(out1970)
> List of 8
> $ comm : num [1:16, 1:57] 1 1 1 1 1 1 1 1 1 1 ...
> ..- attr(*, "dimnames")=List of 2
> .. ..$ : chr [1:16] "H_s5" "H_s1" "R_s2"
"H_s2" ...
> .. ..$ : chr [1:57] "Pimephales.promelas"
"Semotilus.atromaculatus"
> "Rhinichthys.atratulus" "Pimephales.notatus" ...
> $ u : num [1:16, 1:57] 0 0 0 0 0 0 0 0 0 0 ...
> ..- attr(*, "dimnames")=List of 2
> .. ..$ : chr [1:16] "H_s5" "H_s1" "R_s2"
"H_s2" ...
> .. ..$ : chr [1:57] "Pimephales.promelas"
"Semotilus.atromaculatus"
> "Rhinichthys.atratulus" "Pimephales.notatus" ...
> $ r : Named num [1:16] 0.0312 0.0938 0.1562 0.2188 0.2812 ...
> ..- attr(*, "names")= chr [1:16] "H_s5"
"H_s1" "R_s2" "H_s2" ...
> $ c : Named num [1:57] 0.00877 0.02632 0.04386 0.0614 0.07895 ...
> ..- attr(*, "names")= chr [1:57]
"Pimephales.promelas"
> "Semotilus.atromaculatus" "Rhinichthys.atratulus"
"Pimephales.notatus" ...
> $ p : num 1.59
> $ fill : num 0.294
> $ statistic: num 11.4
> $ smooth :List of 2
> ..$ x: num [1:51] 0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 ...
> ..$ y: num [1:51] 1 0.887 0.826 0.776 0.732 ...
> - attr(*, "class")= chr "nestedtemp"
>
>
> I wanted to extract the value $ x and $y from List of 2 (smooth), but I
> could not extarct it. I used following functions
>
> > sapply(out1970$smooth, "[[",1)
> x y
> 0 1
>
> > sapply(out1970$smooth, "[[",2)
> x y
> 0.0200000 0.8869147
> But when I tried to extarct all value using
>
> >sapply(out1970$smooth, "[[",1:51)
> Error in FUN(X[[1L]], ...) : attempt to select more than one element
>
> would you mind to give some suggestions in how I get the value for all
> (1:51) ?
> thanks
> KG
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]