assign $y of predict() function output to variable
On May 18, 2011, at 1:35 PM, Asan Ramzan wrote:
Hello R-help Below is the output from the predict() function. How can I assign $y to a variable.
Newvar <- predict(function,df2)$y
David. > > $x > V1 > 1 36.28 > 2 34.73 > 3 33.74 > 4 69.87 > 5 58.88 > 6 89.44 > 7 43.97 > 8 41.94 > 9 33.34 > 10 38.47 > 11 35.16 > 12 42.94 > 13 46.76 > 14 53.24 > 15 52.43 > 16 50.40 > 17 34.42 > 18 33.22 > 19 33.24 > 20 39.60 > 21 39.32 > 22 44.71 > 23 54.03 > 24 47.48 > 25 35.42 > 26 34.78 > 27 34.31 > 28 78.60 > 29 74.43 > 30 120.80 > 31 48.35 > 32 45.40 > 33 33.95 > 34 38.27 > 35 35.16 > 36 47.10 > 37 48.10 > 38 51.79 > 39 62.10 > 40 50.95 > 41 35.75 > 42 34.62 > 43 57.99 > 44 45.09 > 45 43.93 > 46 60.98 > 47 66.64 > 48 59.84 > 49 64.81 > 50 77.52 > 51 113.40 > 52 88.12 > 53 80.36 > 54 118.80 > 55 113.00 > 56 169.50 > 57 53.04 > 58 63.39 > 59 96.04 > 60 109.80 > 61 83.74 > 62 133.10 > 63 122.30 > 64 168.30 > 65 61.89 > 66 58.58 > 67 75.98 > 68 87.66 > 69 84.01 > 70 132.80 > 71 135.60 > 72 127.70 > $y > V1 > 1 2.676489 > 2 2.070236 > 3 1.682677 > 4 15.853686 > 5 11.523969 > 6 23.030727 > 7 5.678122 > 8 4.886343 > 9 1.526004 > 10 3.532138 > 11 2.238484 > 12 5.276394 > 13 6.766605 > 14 9.301601 > 15 8.983873 > 16 8.188838 > 17 1.948910 > 18 1.478992 > 19 1.486828 > 20 3.973300 > 21 3.864004 > 22 5.966758 > 23 9.611797 > 24 7.047672 > 25 2.340192 > 26 2.089803 > 27 1.905852 > 28 19.180440 > 29 17.611545 > 30 32.357421 > 31 7.387438 > 32 6.235922 > 33 1.764910 > 34 3.454035 > 35 2.238484 > 36 6.899319 > 37 7.289786 > 38 8.733040 > 39 12.798111 > 40 8.404081 > 41 2.469258 > 42 2.027188 > 43 11.172123 > 44 6.114989 > 45 5.662521 > 46 12.354907 > 47 14.589716 > 48 11.903750 > 49 13.869002 > 50 18.778316 > 51 30.387489 > 52 22.579871 > 53 19.828694 > 54 31.838458 > 55 30.277085 > 56 42.186268 > 57 9.223121 > 58 13.308252 > 59 25.211889 > 60 29.379133 > 61 21.048335 > 62 35.336657 > 63 32.740194 > 64 42.003454 > 65 12.715023 > 66 11.405337 > 67 18.199665 > 68 22.421596 > 69 21.144335 > 70 35.268242 > 71 35.898715 > 72 34.073050 > > [[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. David Winsemius, MD Heritage Laboratories West Hartford, CT