Ayman Oweida
2008-Mar-27 20:07 UTC
[R] Extracting single output data into a vector or matrix
I've been struggling to do the following: After a lengthy computation, I receive an output along the lines of the list below. This list has 41 values and is not the end of my computations. I have another computation to do on the list below, but in this final computation the list is supposed to be a vector. I've tried to assign the list below to a data frame and then extract it, but not luck! Cleary, this is because each of the outputs in the list represents an individual data point that is not regarded as part of a matrix. Any help? I desperately need to be able to extract all the output data into a Vector so I can perform the final step of my computation. Thanks in advance. [1] 1.573233e-10 [1] 2.939187e-10 [1] 5.491124e-10 [1] 1.025877e-09 [1] 1.916591e-09 [1] 3.580663e-09 [1] 6.689559e-09 [1] 1.249774e-08 [1] 2.334885e-08 [1] 4.36214e-08 [1] 8.149551e-08 [1] 1.522537e-07 [1] 2.844473e-07 [1] 5.314175e-07 [1] 9.928186e-07 [1] 1.854829e-06 [1] 3.465277e-06 [1] 6.47399e-06 [1] 1.209501e-05 [1] 2.259645e-05 [1] 4.221572e-05 [1] 7.886935e-05 [1] 0.0001473473 [1] 0.0002752811 [1] 0.0005142927 [1] 0.0009608253 [1] 0.001795058 [1] 0.00335361 [1] 0.006265368 [1] 0.01171493 [1] 0.02188637 [1] 0.04088913 [1] 0.07639071 [1] 0.1427168 [1] 0.2666308 [1] 0.4981322 [1] 0.9306848 [1] 1.738748 [1] 3.248409 [1] 6.068827 [1] 11.33806 --------------------------------- [[alternative HTML version deleted]]
Mike Prager
2008-Mar-27 21:01 UTC
[R] Extracting single output data into a vector or matrix
Ayman, It is difficult to say without seeing some code, but your output seems to be not a list in the R sense but a collection of vectors, each of length 1. The best way to put the values into a vector probably is to assign them to the elements of the vector during your computations. Mike Prager Ayman Oweida <ajoweida at yahoo.com> wrote:> I've been struggling to do the following: > After a lengthy computation, I receive an output along the lines of the list below. > This list has 41 values and is not the end of my computations. I have another computation to do on the list below, but in this final computation the list is supposed to be a vector. > I've tried to assign the list below to a data frame and then extract it, but not luck! Cleary, this is because each of the outputs in the list represents an individual data point that is not regarded as part of a matrix. Any help? I desperately need to be able to extract all the output data into a Vector so I can perform the final step of my computation. > > Thanks in advance. > > [1] 1.573233e-10 > [1] 2.939187e-10 > [1] 5.491124e-10 > [1] 1.025877e-09 > [1] 1.916591e-09 > [1] 3.580663e-09 > [1] 6.689559e-09 > [1] 1.249774e-08 > [1] 2.334885e-08 > [1] 4.36214e-08 > [1] 8.149551e-08 > [1] 1.522537e-07 > [1] 2.844473e-07 > [1] 5.314175e-07 > [1] 9.928186e-07 > [1] 1.854829e-06 > [1] 3.465277e-06 > [1] 6.47399e-06 > [1] 1.209501e-05 > [1] 2.259645e-05 > [1] 4.221572e-05 > [1] 7.886935e-05 > [1] 0.0001473473 > [1] 0.0002752811 > [1] 0.0005142927 > [1] 0.0009608253 > [1] 0.001795058 > [1] 0.00335361 > [1] 0.006265368 > [1] 0.01171493 > [1] 0.02188637 > [1] 0.04088913 > [1] 0.07639071 > [1] 0.1427168 > [1] 0.2666308 > [1] 0.4981322 > [1] 0.9306848 > [1] 1.738748 > [1] 3.248409 > [1] 6.068827 > [1] 11.33806 > > > --------------------------------- > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.-- Mike Prager, NOAA, Beaufort, NC * Opinions expressed are personal and not represented otherwise. * Any use of tradenames does not constitute a NOAA endorsement.