Neal, I like this answer. Simple and clean. Don't know why I didn't think of that before.
Thanks! -- Noah Silverman, M.S., C.Phil UCLA Department of Statistics 8117 Math Sciences Building Los Angeles, CA 90095 On Sep 4, 2013, at 3:12 PM, Neal Fultz <nfu...@gmail.com> wrote: > > print(1:100) > [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 > 19 20 21 22 23 24 25 26 > [27] 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 > 45 46 47 48 49 50 51 52 > [53] 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 > 71 72 73 74 75 76 77 78 > [79] 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 > 97 98 99 100 > > cat(1:100) > 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 > 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 > 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 > 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 > > > > On Wed, Sep 4, 2013 at 3:09 PM, Prof Brian Ripley <rip...@stats.ox.ac.uk> > wrote: > On 04/09/2013 22:56, Noah Silverman wrote: > Hi, > > Working with R, I often want to copy and paste some values somewhere else. > (Its not worth saving a CSV file for a dozen or so entries.) Or, I may want > to copy all the names of an object into some code. > > R, rather nicely, wraps output with an index number on the left side. > > For example: > > [1] -1.07781972 -1.12157840 1.79303276 1.53313388 -1.30854455 0.45641730 > 0.23866722 -1.96265084 > [9] -1.90779578 -0.68418936 -2.04910282 0.12008358 -1.71072687 > -0.36707605 -0.36939204 -2.02799948 > [17] 0.36466562 -1.34204214 -0.45100125 -0.60483154 0.42208268 > -0.89535576 -1.09398009 -2.07257728 > [25] -0.04615273 -0.23659570 0.27232736 1.28432538 -2.17042948 > -0.45364579 1.52957528 0.39838320 > [33] 0.64923323 -1.01651051 -0.36287974 -0.73787761 0.48088199 > -1.19539814 -0.80079095 -1.02507331 > > > > While this is great to read on screen, it is a pain to have to edit out all > the index numbers. > > Is there a simple way to just back the values, or even a comma separated list > of the values? > > There are many. Here I usually use write(x, ""). The file = "" trick works > in many other functions. > > Using dput() and removing c( and ) is also often useful when comma separation > is needed. > > > -- > Brian D. Ripley, rip...@stats.ox.ac.uk > Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ > University of Oxford, Tel: +44 1865 272861 (self) > 1 South Parks Road, +44 1865 272866 (PA) > Oxford OX1 3TG, UK Fax: +44 1865 272595 > > > ______________________________________________ > 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]] ______________________________________________ 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.